package cn.fl.project.controller;

import cmm.comm.facade.framework.api.ISysCdMapApiService;
import cmm.comm.facade.framework.api.ISysCtrlCfgApiService;
import cmm.comm.facade.framework.api.ISysDictionaryApiService;
import cmm.comm.facade.framework.condition.SysCdMapDQueryCondition;
import cmm.comm.facade.framework.condition.SysCtrlCfgQueryCondition;
import cmm.comm.facade.framework.dto.SysCdMapDDTO;
import cmm.comm.facade.framework.dto.SysDictionaryDTO;
import cmm.comm.facade.upload.condition.SysUlDatCfgQueryCondition;
import cmm.comm.facade.upload.condition.SysUlFilesRecQueryCondition;
import cmm.comm.facade.upload.constant.SysUlFilesRecConstant;
import cmm.comm.facade.upload.constant.UploadConstant;
import cmm.mid.core.framework.dto.BaseParamDTO;
import cmm.mid.core.framework.dto.DataResultDTO;
import cmm.mid.core.framework.page.DataResultVO;
import cmm.mid.core.framework.page.KeyValueVO;
import cmm.mid.core.framework.page.ListPageVO;
import cmm.mid.core.framework.page.Pager;
import cmm.user.facade.system.api.ISysUsrApiService;
import cmm.user.facade.system.condition.SysUsrQueryCondition;
import cmm.user.facade.system.dto.SysUsrDTO;
import cmm.user.facade.system.dto.SysUsrFunAuthRDTO;
import cmm.web.core.framework.controller.BaseController;
import cn.cmm.base.framework.constant.BaseConstant;
import cn.cmm.base.framework.constant.BaseExceptionConstant;
import cn.cmm.base.framework.context.ApplicationContextAccessor;
import cn.cmm.base.framework.exception.BaseException;
import cn.cmm.base.framework.logger.eum.LogExceptionEnum;
import cn.cmm.base.framework.utils.*;
import cn.cmm.cache.framework.utils.PropertiesCacheUtils;
import cn.fl.audit.service.IAudCreditInfoService;
import cn.fl.audit.service.IAudReturnVisitService;
import cn.fl.audit.vo.AudCreditInfoVO;
import cn.fl.capital.condition.CapPayInfoQueryCondition;
import cn.fl.capital.condition.CapPayeeInfoQueryCondition;
import cn.fl.capital.constant.CapitalConstant;
import cn.fl.capital.constant.FlowInfoConstant;
import cn.fl.capital.service.ICapPayInfoService;
import cn.fl.capital.service.ICapPayeeInfoService;
import cn.fl.capital.vo.CapPayInfoVO;
import cn.fl.capital.vo.CapPayMaterialVo;
import cn.fl.capital.vo.CapPayeeInfoVO;
import cn.fl.carloan.service.IOdrBscInfoService;
import cn.fl.carloan.vo.OdrBscInfoVO;
import cn.fl.commons.result.ResponseData;
import cn.fl.customer.service.*;
import cn.fl.customer.vo.*;
import cn.fl.enums.ChangeTypeCodeEnum;
import cn.fl.enums.IsAllowNonInsBizEnum;
import cn.fl.finance.condition.FinLoanInfoQC;
import cn.fl.finance.dto.FinLoanInfoDTO;
import cn.fl.finance.service.IFinLoanInfoService;
import cn.fl.finance.vo.FinLoanInfoVO;
import cn.fl.flow.service.IFlowService;
import cn.fl.framework.base.constant.WebBaseConstant;
import cn.fl.framework.base.context.CurrentThreadContext;
import cn.fl.framework.base.utils.WebBaseUtils;
import cn.fl.framework.constant.DictionaryConstant;
import cn.fl.insroute.service.IInsRouteBscInfoService;
import cn.fl.institution.constant.PrjInsRedmInterfaceInfoConstant;
import cn.fl.preinsroute.api.IPreRouteModifyApiService;
import cn.fl.preinsroute.api.IPreRouteQueryApiService;
import cn.fl.preinsroute.condition.PreRouteBscInfoQC;
import cn.fl.preinsroute.condition.PreRouteInsResQC;
import cn.fl.preinsroute.dto.PreRouteBscInfoDTO;
import cn.fl.preinsroute.transform.PreRouteBscInfoVOTransform;
import cn.fl.preinsroute.transform.PreRouteInsResVOTransform;
import cn.fl.preinsroute.vo.PreRouteBscInfoVO;
import cn.fl.preinsroute.vo.PreRouteInsResVO;
import cn.fl.preloan.IAuditCreditInfoService;
import cn.fl.preloan.IInsPlcBscInfoService;
import cn.fl.preloan.condition.AuditCreditInfoQueryCondition;
import cn.fl.preloan.condition.InsPlcBscInfoQueryCondition;
import cn.fl.preloan.condition.PrjPrdDtlGpsQueryCondition;
import cn.fl.preloan.condition.PrjPreAudInfoQueryCondition;
import cn.fl.preloan.dto.ChangeBusinessInfoRequest;
import cn.fl.preloan.dto.audit.AudCreditInfoListRequest;
import cn.fl.preloan.dto.audit.AuditCreditInfoDTO;
import cn.fl.preloan.dto.insurance.GetInsPlcBscInfoListRequest;
import cn.fl.preloan.dto.insurance.InsPlcBscInfoDTO;
import cn.fl.preloan.dto.insurance.ModifyInsPlcBscInfoRequest;
import cn.fl.preloan.dto.prjpreaudinfo.PrjPreAudInfoDTO;
import cn.fl.preloan.enums.LogBusinessTypeEnum;
import cn.fl.preloan.financialinterface.IFinancialService;
import cn.fl.preloan.prjpreaudinfo.IPrjPreAudInfoApiService;
import cn.fl.prjprddtlgps.service.IPrjPrdDtlGpsService;
import cn.fl.prjprddtlgps.vo.PrjPrdDtlGpsVO;
import cn.fl.product.service.IPrdBscInfoService;
import cn.fl.product.service.ISplBankService;
import cn.fl.product.service.ISplInfoService;
import cn.fl.product.service.ISplRlPsnService;
import cn.fl.product.vo.*;
import cn.fl.project.api.IPrjBscExtApiService;
import cn.fl.project.condition.*;
import cn.fl.project.constant.*;
import cn.fl.project.dto.*;
import cn.fl.project.service.*;
import cn.fl.project.transfer.service.IPrjTransferInfoService;
import cn.fl.project.transfer.vo.PrjTransferInfoVO;
import cn.fl.project.transform.PrjBscInfoVOTransform;
import cn.fl.project.vo.*;
import cn.fl.rebacc.web.service.ISaleRebAccInfoService;
import cn.fl.rebacc.web.vo.SaleRebAccInfoVO;
import cn.fl.ref.fribaseinfo.service.IFriBaseInfoService;
import cn.fl.ref.fribaseinfo.transform.FriBaseInfoVOTransform;
import cn.fl.ref.fribaseinfo.utils.FundRasInsNmChangeUtil;
import cn.fl.ref.fribaseinfo.vo.FriBaseInfoVO;
import cn.fl.riskctrl.service.IRcCstBscInfoService;
import cn.fl.risknew.service.IRiskOverdueService;
import cn.fl.spl.utils.FileUtil;
import cn.fl.system.constant.SysLogConstant;
import cn.fl.system.service.ISysInsTabCfgService;
import cn.fl.system.service.ISysUlDatCfgService;
import cn.fl.system.service.ISysUlFilesRecService;
import cn.fl.system.service.ISysUsrService;
import cn.fl.system.vo.*;
import cn.fl.warrant.service.IArcBorrowMainService;
import cn.fl.warrant.service.IArcTransferMainService;
import cn.fl.warrant.transform.ArcTransferMainVOTransform;
import cn.fl.warrant.vo.ArcBorrowMainVO;
import cn.lionbridgecapital.loan.model.po.PrjPrdDtl;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.itextpdf.text.Document;
import com.lionbridge.activiti.dto.MessageDTO;
import com.lionbridge.log.ext.ExtSlf4jLogger;
import com.lionbridge.log.ext.ExtSlf4jLoggerBuilder;
import com.lionbridge.log.ext.LogTypeEnum;
import com.lowagie.text.DocumentException;
import com.lowagie.text.pdf.BaseFont;
import cvm.store.facade.cvm.api.ICvmApiService;
import cvm.store.facade.cvm.dto.VechileParaConfDTO;
import fl.customer.facade.customer.api.ICustomerApiService;
import fl.customer.facade.customer.condition.CstCorpHisQueryCondition;
import fl.customer.facade.customer.condition.CstCorpTeamQueryCondition;
import fl.customer.facade.customer.condition.CstCorpTeamResumeQueryCondition;
import fl.customer.facade.customer.condition.CstUsrRQueryCondition;
import fl.customer.facade.customer.constant.CustomerConstant;
import fl.customer.facade.customer.dto.CstBankDTO;
import fl.flow.facade.flow.api.IFlowApiService;
import fl.flow.facade.flow.api.IFlowQueryApiService;
import fl.flow.facade.flow.condition.SysFlowManageVQueryCondition;
import fl.flow.facade.flow.condition.SysFlowSHQueryCondition;
import fl.flow.facade.flow.constant.FlowConstant;
import fl.flow.facade.flow.dto.*;
import fl.product.facade.product.condition.PrdCarInfoQueryCondition;
import fl.product.facade.product.condition.PrdTkInfoQueryCondition;
import fl.product.facade.product.constant.ProductConstant;
import fl.ref.fribaseinfo.condition.FriBaseInfoQueryCondition;
import fl.ref.fribaseinfo.constant.FriBaseInfoConstant;
import fl.ref.fribaseinfo.dto.FriBaseInfoDTO;
import fl.riskctrl.facade.riskctrl.api.IRiskCtrlSearchApiService;
import fl.riskctrl.facade.riskctrl.dto.RcCstBscInfoDTO;
import fl.spl.facade.framework.enums.FlowStartRelInfoCfgEnum;
import fl.spl.facade.spl.condition.SplRlPsnQueryCondition;
import fl.spl.facade.store.api.ISplPropInfoApiService;
import fl.warrant.facade.archive.api.IArcMgrMainApiService;
import fl.warrant.facade.archive.condition.ArcBorrowMainQueryCondition;
import fl.warrant.facade.archive.condition.ArcMgrMainQC;
import fl.warrant.facade.archive.condition.ArcTransferMainQueryCondition;
import fl.warrant.facade.archive.dto.ArcMgrMainDTO;
import fl.warrant.facade.archive.dto.ArcTransferMainDTO;
import freemarker.template.Configuration;
import freemarker.template.Template;
import lombok.extern.slf4j.Slf4j;
import net.sf.json.JSONArray;
import org.apache.commons.collections.MapUtils;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import org.xhtmlrenderer.pdf.ITextFontResolver;
import org.xhtmlrenderer.pdf.ITextRenderer;
import pam.transmissionrec.facade.api.ITransLogApiService;
import pam.transmissionrec.facade.dto.QueryStatusDTO;
import veh.autoinsp.facade.autoinsp.api.ISendRecDataApiService;
import veh.src.facade.src.src.api.IVehSrcInfQueryApiService;
import veh.src.facade.src.src.condition.VehSrcInfQC;
import veh.src.facade.src.src.dto.VehSrcInfDTO;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @Description: 项目基础信息表 控制层
 */
@Slf4j
@Controller
@RequestMapping("/project/prjbscinfo")
public class PrjBscInfoController extends BaseController {

	private static ExtSlf4jLogger logger = ExtSlf4jLoggerBuilder.create()
			.setLogger(log).setBusinessType(LogBusinessTypeEnum.QUOTATION_SCHEME.getCode())
			.setSubBusinessType(LogBusinessTypeEnum.QUOTATION_SCHEME.getCode())
			.setLogType(LogTypeEnum.BUSINESS).build().setKeywords("PrjBscInfo");
    /**
     * 系统资源服务
     */
    private ISysCtrlCfgApiService sysCtrlCfgApiService = (ISysCtrlCfgApiService) ApplicationContextAccessor.getBean("sysCtrlCfgApiService");
    @Autowired
	private IRiskCtrlSearchApiService riskCtrlSearchApiService;//风控管理、配置、征信查询
	/**
	 * PrjBscInfo 服务层BEAN
	 */
	@Autowired
	private IPrjBscInfoService prjBscInfoService;//项目基础信息表
	/**
	 * 数据字典服务
	 */
	@Autowired
	private ISysDictionaryApiService sysDictionaryApiService;
	/**
	 * TODO 自定义 API 暴露服务
	 */
	@Autowired
	private IProjectApiService projectApiService;

	@Autowired
	private ISplBankService prdSplBankService;//供应商开户银行信息表

	@Autowired
	private ICapPayeeInfoService capPayeeInfoService;//付款收款方信息表

	@Autowired
	private ICapPayInfoService capPayInfoService;//付款信息表

	@Autowired
	private IInsPlcBscInfoService insPlcBscInfoService;//保单基础信息表

	@Autowired
	private IFlowService flowService;

	/**
	 * 产品 服务层BEAN
	 */
	@Autowired
	private IPrdBscInfoService prdBscInfoService;

	/**
	 * 产品 服务层BEAN
	 */
	@Autowired
	private IPrjLnkCompService prjLnkCompService;//挂靠公司表
	/**
	 * 客户 服务层BEAN
	 */
	@Autowired
	private ICstBscInfoService cstBscInfoService;//客户基础信息表
	/**
	 * 文件 服务层BEAN
	 */
	@Autowired
	private ISysUlFilesRecService sysUlFilesRecService;//文件上传记录表

	@Autowired
	private IPrjLinkManService prjLinkManService;//项目联系人信息表

	/**
	 * 上传文件主配置数据 服务层BEAN
	 */
	@Autowired
	private ISysUlDatCfgService sysUlDatCfgService;//上传资料配置表
	@Autowired
	private IPrjCstInvestRptService prjCstInvestRptService;//客户调查报告表
	@Autowired
	private IPrjCstProfitAnaService prjCstProfitAnaService;//收益分析表
	@Autowired
	private IPrjCstRepayAbiService prjCstRepayAbiService;//客户还款能力调查表
	@Autowired
	private ISysUsrService sysUsrService;//系统用户表
	@Autowired
	private ICstUsrRService cstUsrRService;//客户-用户关系表

	@Autowired
	private ICstCorpHisService cstCorpHisService;// 法人公司历史信息表
	@Autowired
	private ICstCorpTeamService cstCorpTeamService;// 法人企业团队信息表
	@Autowired
	private ICstCorpTeamResumeService cstCorpTeamResumeService;// 法人企业团队信息表
	@Autowired
	private ISplInfoService prdSplInfoService;// 供应商信息
	/**
	 * PrdSplRlPsn 服务层BEAN
	 */
	@Autowired
	private ISplRlPsnService prdSplRlPsnService;//供应商关联人员信息表

	@Autowired
	private ISplBankService splBankService;//供应商开户银行信息表

	/**
	 * 项目产品本地服务
	 */
	@Autowired
	private IPrjPrdBscInfoService prjPrdBscInfoService;//项目产品基本信息表
	@Autowired
	private IPrjQuatPrpsCfgMService prjQuatPrpsCfgMService;//项目报价方案配置主信息表

	@Autowired
	private IPrjCstBscInfoService prjCstBscInfoService;//项目客户基础信息表
	@Autowired
	private IPrjPrdDtlService prjPrdDtlService;//项目产品明细信息表

	@Autowired
	private IPrjQuatPrpsService prjQuatPrpsService;//项目报价方案表

	@Autowired
	private IPrjQuatPrpsFeeService prjQuatPrpsFeeService;

	@Autowired
	private IFriBaseInfoService friBaseInfoService;//融资机构基础信息表
	@Autowired
	private IRcCstBscInfoService rcCstBscInfoService;//风险控制基础信息表

	/**
	 * 供应商返利账号
	 */
	@Autowired
	private IPrjSplBankAccRService prjSplBankAccRService;//项目供应商银行账户关系表

	@Autowired
	private IPrjPrdPaySchDService prjPrdPaySchDService;//项目产品支付表主明细信息
	@Autowired
	private ICstNpBscInfoService cstNpBscInfoService;
	/**
	 * AudReturnVisit 服务层BEAN
	 */
	@Autowired
	private IAudReturnVisitService audReturnVisitService;
	@Autowired
	private IAudCreditInfoService audCreditInfoService;

	@Autowired
	private IOdrBscInfoService odrBscInfoService;//车抵贷

	@Autowired
	private ISysInsTabCfgService sysInsTabCfgService; // 资管机构模块配置

	// 支付表主表服务
	@Autowired
	private IPrjPrdPaySchMService prjPrdPaySchMService;

	// 返利账号的服务
	@Autowired
	private ISaleRebAccInfoService saleRebAccInfoService;

	// 流程的服务
	@Autowired
	private IFlowApiService flowApiService;

	@Autowired
	private IVehSrcInfQueryApiService vehSrcInfQueryApiService;

	@Autowired
	private ICvmApiService cvmApiService;

	@Autowired
	private IPrjPrdVehInfoService prjPrdVehInfoService;

	@Autowired
	private IPrjPrdDtlGpsService prjPrdDtlGpsService;

	@Autowired
	private ISendRecDataApiService sendRecDataApiService;

	@Autowired
	private ICstBankService cstBankService;

	@Autowired
	private ICustomerApiService customerApiService;
	@Autowired
	private IPrjTransferInfoService prjTransferInfoService;//项目移交记录
	@Autowired
	private IArcTransferMainService arcTransferMainService;//权证 结清移交
	@Autowired
	private IArcMgrMainApiService arcMgrMainApiService;//权证 归档
	@Autowired
	private IArcBorrowMainService arcBorrowMainService;//权证 借阅
	@Autowired
	private IFinLoanInfoService finLoanInfoService;//借款 还款
	@Autowired
	private ISysUsrApiService sysUsrApiService;
	@Autowired
	private IInsRouteBscInfoService insRouteBscInfoService;
	@Autowired
	private IPrjPrdInvoiceService prjPrdInvoiceService;
	@Autowired
	private IPrjBscExtApiService prjBscExtApiService;
	@Autowired
	private IAuditCreditInfoService auditCreditInfoService;

	@Autowired
	private ISysCdMapApiService sysCdMapApiService;

    /**
     * 预筛选查询服务
     */
	@Autowired
    private IPreRouteQueryApiService preRouteQueryApiService;
    /**
     * 资管路由预筛选修改服务
     */
	@Autowired
    private IPreRouteModifyApiService preRouteModifyApiService;

	@Autowired
	private IFlowQueryApiService flowQueryApiService;

	@Autowired
	private IPrjPreAudInfoApiService prjPreAudInfoApiService;

	@Autowired
	private IFinancialService financialService;

	@Autowired
	private IRiskOverdueService overdueService;

	@Autowired
	private ITransLogApiService transLogApiService;

	@Autowired
	private ISplPropInfoApiService iSplPropInfoApiService;

	/**
	 * YAOXIURONG 查询指定项目 2017-4-18
	 */
	@RequestMapping(value = "/toOldPrjBscInfoListPage.do", method = { RequestMethod.GET })
	public ModelAndView toOldPrjBscInfoListPage(HttpServletRequest request,
												HttpServletResponse response) {
		logger.info("加载toOldPrjBscInfoListPage列表页面.");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/oldPrjBscInfoList");
		// 项目类型
		List<KeyValueVO> projectTypeList = this.prjBscInfoService
				.getProjectTypeList();
		// 业务类型
		List<KeyValueVO> bizTypeList = this.prjBscInfoService.getBizTypeList();
		// 项目状态
		List<KeyValueVO> prjStsList = this.prjBscInfoService.getPrjStsList();
		// 事业部
		List<KeyValueVO> orgList = this.cstBscInfoService
				.searchBusinessOrgList();
		view.addObject("orgListList", orgList);
		view.addObject("projectTypeList", projectTypeList);
		view.addObject("bizTypeList", bizTypeList);
		view.addObject("prjStsList", prjStsList);
		view.addObject("queryFlag", "query");// 查询列表隐藏操作按钮
		view.addObject("currentBuOrgCd",
				CurrentThreadContext.getCurrentBuOrgCd());
		return view;
	}

	/**
	 * YAOXIURONG 提供指定项目查询资信页面 2017-4-18
	 *
	 * @param request
	 * @param response
	 * @return
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initOldList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initOldList(HttpServletRequest request,
							  HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prjNm = request.getParameter("prjNm");
		String cstNm = request.getParameter("cstNm");
		String prjTyCd = request.getParameter("prjTypCd");
		String bizTypCd = request.getParameter("bizTypCd");
		String prjStsCd = request.getParameter("prjStsCd");
		String buOrgCd = request.getParameter("buOrgCd");// 事业部
		String lsCntNo = request.getParameter("lsCntNo");
		String cntTypCd = request.getParameter("cntTypCd");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrjBscInfoQueryCondition qc = new PrjBscInfoQueryCondition();
		if (StringUtils.isNotBlank(buOrgCd)) {
			qc.setBuOrgCd(buOrgCd);
		}
		if (StringUtils.isNotBlank(cntTypCd)) {
			qc.setCntTypCd(cntTypCd);
		}
		if (StringUtils.isNotBlank(lsCntNo)) {
			qc.setLsCntNo(lsCntNo);
		}
		if (StringUtils.isNotBlank(prjNm)) {
			qc.setPrjNm(prjNm);
		}
		if (StringUtils.isNotBlank(cstNm)) {
			qc.setCstNm(cstNm);
		}
		if (StringUtils.isNotBlank(prjTyCd)) {
			qc.setPrjTypCd(prjTyCd);
		}
		if (StringUtils.isNotBlank(bizTypCd)) {
			qc.setBizTypCd(bizTypCd);
		}
		if (StringUtils.isNotBlank(prjStsCd)) {
			if (prjStsCd.equals(FlowConstant.FLOW_CHECK_STATE_NON)) {
				qc.setDefPrjStsCd(prjStsCd);
			} else {
				qc.setPrjStsCd(prjStsCd);
			}
			qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		}
		qc.setUsrId(CurrentThreadContext.getCurrentUserId());
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		page.setCondition(qc);
		Pager pager = this.prjBscInfoService.searchOldListPage(page);
		List<PrjBscInfoVO> list = (List<PrjBscInfoVO>) pager.getResultList();
		ListPageVO<PrjBscInfoVO> listPage = new ListPageVO<PrjBscInfoVO>(list,
				pager.getTotalCount());
		return listPage;
	}

	/**
	 *
	 * 到列表页面
	 */
	@RequestMapping(value = "/toPrjBscInfoListPage.do", method = { RequestMethod.GET })
	public ModelAndView toPrjBscInfoListPage(HttpServletRequest request,HttpServletResponse response) {
		logger.info("加载PrjBscInfo列表页面.");
		ModelAndView view = new ModelAndView("project/prjbscinfo/projectPrjBscInfoList");
		String queryFlag = request.getParameter("query");//只查询列表
		String lnkCompId = request.getParameter("lnkCompId");//
		String mgrPrjViewFlag = request.getParameter("mgrPrjViewFlag");//客户经理关联项目页面
		String isLnkCompFlag = request.getParameter("isLnkCompFlag");
		//挂靠公司项目页面标示
		String isLnkPrjViewFlag = request.getParameter("isLnkPrjViewFlag");
		// 项目类型
		List<KeyValueVO> projectTypeList = this.prjBscInfoService
				.getPrjTypCdALLKV();		// 业务类型

		List<KeyValueVO> bizTypeList = this.prjBscInfoService.getBizTypeList();
		// 项目状态
		List<KeyValueVO> prjStsList = this.prjBscInfoService.getPrjStsList();
		//代偿担保业务类型
		List<KeyValueVO> compensatoryTypeList = this.prjBscInfoService.getCompensatoryTypeList();
		// 事业部
		List<KeyValueVO> orgList = this.cstBscInfoService
				.searchBusinessOrgList();
		// 合同签署方式
		List<KeyValueVO> cntTypCdList = this.prjBscInfoService
				.getCntTypCdList();
		// 所属区域
		List<KeyValueVO> regionList = this.prjBscInfoService.getRegionList();
		//业务线字典List
		List<KeyValueVO> bussinessLineDicList = sysDictionaryApiService.getKvList("REF0048","11000","0000");

		String currentOrgCd = CurrentThreadContext.getCurrentOrgCd();
		if(currentOrgCd.length()>8){
			if(CollectionUtils.isNotEmpty(orgList)){
				for(KeyValueVO kv:orgList){
					if(kv.getKey().equals(currentOrgCd.substring(0, 8))){
						view.addObject("currOrg", CurrentThreadContext.getCurrentOrgCd());
						break;
					}
				}
			}
		}
		Long currCrAmt = null;
		if(StringUtils.isNotBlank(lnkCompId)){
			currCrAmt = this.prjPrdPaySchDService.searchCurrLnkCompCrAmtByLnkId(Long.valueOf(lnkCompId));
		}
		Pager page = new Pager();
		page.setCurrentPage(1);
		page.setEveryPage(Integer.MAX_VALUE);
		FriBaseInfoQueryCondition qc = new FriBaseInfoQueryCondition();
		qc.setInsSts(FriBaseInfoConstant.FRI_BASE_INFO_INS_STS_PASS);
		qc.setInsUseCd("2");
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		page.setCondition(qc);
		Pager pager = this.friBaseInfoService.searchListPage(page);
		//List<FriBaseInfoVO> list = (List<FriBaseInfoVO>) pager.getResultList();
		List<FriBaseInfoVO> list = FriBaseInfoVOTransform.toVOList((List<FriBaseInfoDTO>) pager.getResultList());
		//根据金融机构业务线,设置金融机构名称展示字段值
		FundRasInsNmChangeUtil.insNmShowAddBussinessLineDic(list,bussinessLineDicList);
		view.addObject("friBaseList", list);
		view.addObject("currCrAmt", DecimalUtils.convertFenToYuan(currCrAmt));
		view.addObject("orgListList", orgList);
		view.addObject("projectTypeList", projectTypeList);
		view.addObject("cntTypCdList", cntTypCdList);
		view.addObject("compensatoryTypeList", compensatoryTypeList);
		view.addObject("bizTypeList", bizTypeList);
		view.addObject("prjStsList", prjStsList);
		view.addObject("queryFlag", queryFlag);// 查询列表隐藏操作按钮
        view.addObject("addFlowFlag", "true");// 是否展示发起流程按钮

        view.addObject("lnkCompId", lnkCompId);
		view.addObject("isLnkCompFlag", isLnkCompFlag);
		view.addObject("currentBuOrgCd",
				CurrentThreadContext.getCurrentBuOrgCd());
		if("mgrPrjViewFlag".equals(mgrPrjViewFlag)){
			view.addObject("mgrPrjViewFlag",mgrPrjViewFlag);
			view.addObject("cstMgrId",request.getParameter("cstMgrId"));
		}
		//添加挂靠公司项目标示
		view.addObject("isLnkPrjViewFlag",isLnkPrjViewFlag);
		view.addObject("roleId",CurrentThreadContext.getCurrentRoleId());
		view.addObject("orgCd",CurrentThreadContext.getCurrentOrgCd());
		view.addObject("regionList", regionList);
        view.addObject("currentUsrId", CurrentThreadContext.getCurrentUserId());
		logger.info("===当前用户组织架构===cd:"+JSON.toJSONString(CurrentThreadContext.getCurrentOrgCd()) + ",组织架构:" + CurrentThreadContext.getCurrentOrgShtNm());
		SysCdMapDQueryCondition sysCdMapDQC = new SysCdMapDQueryCondition();
		sysCdMapDQC.setSysCd(CurrentThreadContext.getCurrentSysCd());
		sysCdMapDQC.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		sysCdMapDQC.setmTypCd("M1076");
		List<String> getsCodeList = new ArrayList<>();
		getsCodeList.add("orgCd");
		sysCdMapDQC.setsCodeList(getsCodeList);
		logger.info("===调ISysCdMapApiService查询映射的流程KEY开始===condition:"+JSON.toJSONString(sysCdMapDQC));
		List<SysCdMapDDTO> sysCdMapDDTOList = this.sysCdMapApiService.searchSysCdMapDWithTargetList(sysCdMapDQC);
		logger.info("===调ISysCdMapApiService查询映射的流程KEY结束===sysCdMapDDTOList:"+JSON.toJSONString(sysCdMapDDTOList));
		boolean expFlowStartBtnShowFlag = false;
		for (SysCdMapDDTO sysCdMapDDTO : sysCdMapDDTOList) {
			String tCode = sysCdMapDDTO.getTCode();
			if (CurrentThreadContext.getCurrentOrgCd().contains(tCode)) {
				expFlowStartBtnShowFlag = true;
			}
		}
		if (expFlowStartBtnShowFlag) view.addObject("expFlowStartBtnShow", true);
        return view;
	}

	/**
	 * 到列表页面
	 */
	@RequestMapping(value = "/toQueryPrjBscInfoListPage.do", method = { RequestMethod.GET })
	public ModelAndView toQueryPrjBscInfoListPage(HttpServletRequest request,
												  HttpServletResponse response) {
		logger.info("加载PrjBscInfo列表页面.");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectPrjBscInfoList");
		//代偿担保业务类型
		List<KeyValueVO> compensatoryTypeList = this.prjBscInfoService.getCompensatoryTypeList();
		// 项目类型
		List<KeyValueVO> projectTypeList = this.prjBscInfoService
				.getPrjTypCdALLKV();
		// 业务类型
		List<KeyValueVO> bizTypeList = this.prjBscInfoService.getBizTypeList();
		// 项目状态
		List<KeyValueVO> prjStsList = this.prjBscInfoService.getPrjStsList();
		// 事业部
		List<KeyValueVO> orgList = this.cstBscInfoService
				.searchBusinessOrgList();
		// 合同签署方式
		List<KeyValueVO> cntTypCdList = this.prjBscInfoService
				.getCntTypCdList();
		// 所属区域
		List<KeyValueVO> regionList = this.prjBscInfoService.getRegionList();
		//业务线字典List
		List<KeyValueVO> bussinessLineDicList = sysDictionaryApiService.getKvList("REF0048","11000","0000");

		String currentOrgCd = CurrentThreadContext.getCurrentOrgCd();
		if(currentOrgCd.length()>8){
			if(CollectionUtils.isNotEmpty(orgList)){
				for(KeyValueVO kv:orgList){
					if(kv.getKey().equals(currentOrgCd.substring(0, 8))){
						view.addObject("currOrg", CurrentThreadContext.getCurrentOrgCd());
						break;
					}
				}
			}
		}
		Pager page = new Pager();
		page.setCurrentPage(1);
		page.setEveryPage(Integer.MAX_VALUE);
		FriBaseInfoQueryCondition qc = new FriBaseInfoQueryCondition();
		qc.setInsSts(FriBaseInfoConstant.FRI_BASE_INFO_INS_STS_PASS);
		qc.setInsUseCd("2");
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		page.setCondition(qc);
		Pager pager = this.friBaseInfoService.searchListPage(page);
		//List<FriBaseInfoVO> list = (List<FriBaseInfoVO>) pager.getResultList();
		List<FriBaseInfoVO> list = FriBaseInfoVOTransform.toVOList((List<FriBaseInfoDTO>) pager.getResultList());
		//根据金融机构业务线,设置金融机构名称展示字段值
		FundRasInsNmChangeUtil.insNmShowAddBussinessLineDic(list,bussinessLineDicList);
		view.addObject("friBaseList", list);
		view.addObject("cntTypCdList", cntTypCdList);
		view.addObject("orgListList", orgList);
		view.addObject("projectTypeList", projectTypeList);
		view.addObject("compensatoryTypeList", compensatoryTypeList);
		view.addObject("bizTypeList", bizTypeList);
		view.addObject("prjStsList", prjStsList);
		view.addObject("regionList", regionList);
		view.addObject("queryFlag", "query");// 查询列表隐藏操作按钮
		//view.addObject("updateFlag", "update");//业务移交、供应商修改
		view.addObject("currentBuOrgCd",
				CurrentThreadContext.getCurrentBuOrgCd());
        view.addObject("currentUsrId", CurrentThreadContext.getCurrentUserId());
        return view;
	}

	/**
	 * 到列表页面(业务移交)
	 */
	@RequestMapping(value = "/toUpdateMgrPrjBscInfoListPage.do", method = { RequestMethod.GET })
	public ModelAndView toUpdateMgrPrjBscInfoListPage(HttpServletRequest request,
													  HttpServletResponse response) {
		logger.info("加载PrjBscInfo列表页面.");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectPrjBscInfoList");
		// 项目类型
		List<KeyValueVO> projectTypeList = this.prjBscInfoService
				.getProjectTypeList();
		// 业务类型
		List<KeyValueVO> bizTypeList = this.prjBscInfoService.getBizTypeList();
		// 项目状态
		List<KeyValueVO> prjStsList = this.prjBscInfoService.getPrjStsList();
		// 事业部
		List<KeyValueVO> orgList = this.cstBscInfoService
				.searchBusinessOrgList();
		// 合同签署方式
		List<KeyValueVO> cntTypCdList = this.prjBscInfoService
				.getCntTypCdList();
		String currentOrgCd = CurrentThreadContext.getCurrentOrgCd();
		if(currentOrgCd.length()>8){
			if(CollectionUtils.isNotEmpty(orgList)){
				for(KeyValueVO kv:orgList){
					if(kv.getKey().equals(currentOrgCd.substring(0, 8))){
						view.addObject("currOrg", CurrentThreadContext.getCurrentOrgCd());
						break;
					}
				}
			}
		}
		view.addObject("cntTypCdList", cntTypCdList);
		view.addObject("orgListList", orgList);
		view.addObject("projectTypeList", projectTypeList);
		view.addObject("bizTypeList", bizTypeList);
		view.addObject("prjStsList", prjStsList);
		view.addObject("queryFlag", "query");// 查询列表隐藏操作按钮
		view.addObject("updateFlag", "update");//业务移交
		view.addObject("taskTransfer", "query");//任务交接 : query 显示按钮
		view.addObject("prjTransfer", "query");//移交记录 REQ-4030 add by gengchunlan 20190708
		view.addObject("currentBuOrgCd",
				CurrentThreadContext.getCurrentBuOrgCd());
        view.addObject("currentUsrId", CurrentThreadContext.getCurrentUserId());
        return view;
	}

	/**
	 * 到列表页面(供应商及账号修改)
	 */
	@RequestMapping(value = "/toUpdateSplPrjBscInfoListPage.do", method = { RequestMethod.GET })
	public ModelAndView toUpdateSplPrjBscInfoListPage(HttpServletRequest request,
													  HttpServletResponse response) {
		logger.info("加载PrjBscInfo列表页面.");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectPrjBscInfoList");
		// 项目类型
		List<KeyValueVO> projectTypeList = this.prjBscInfoService
				.getProjectTypeList();
		// 业务类型
		List<KeyValueVO> bizTypeList = this.prjBscInfoService.getBizTypeList();
		// 项目状态
		List<KeyValueVO> prjStsList = this.prjBscInfoService.getPrjStsList();
		// 事业部
		List<KeyValueVO> orgList = this.cstBscInfoService
				.searchBusinessOrgList();
		// 合同签署方式
		List<KeyValueVO> cntTypCdList = this.prjBscInfoService
				.getCntTypCdList();
		String currentOrgCd = CurrentThreadContext.getCurrentOrgCd();
		if(currentOrgCd.length()>8){
			if(CollectionUtils.isNotEmpty(orgList)){
				for(KeyValueVO kv:orgList){
					if(kv.getKey().equals(currentOrgCd.substring(0, 8))){
						view.addObject("currOrg", CurrentThreadContext.getCurrentOrgCd());
						break;
					}
				}
			}
		}
		view.addObject("cntTypCdList", cntTypCdList);
		view.addObject("orgListList", orgList);
		view.addObject("projectTypeList", projectTypeList);
		view.addObject("bizTypeList", bizTypeList);
		view.addObject("prjStsList", prjStsList);
		view.addObject("queryFlag", "query");// 查询列表隐藏操作按钮
		view.addObject("updateSunFlag", "update");//供应商及账号修改
		view.addObject("currentBuOrgCd",
				CurrentThreadContext.getCurrentBuOrgCd());
        view.addObject("currentUsrId", CurrentThreadContext.getCurrentUserId());
        return view;
	}
	/*
	 * 业务转移
	 *
	 */
	@RequestMapping(value = "/changeMgr.do", method = { RequestMethod.GET })
	public ModelAndView changeMgr(HttpServletRequest request,
								  HttpServletResponse response){
		String ids = request.getParameter("ids");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/changeMgr");
		view.addObject("prjIds", ids);
		return view;
	}
	/*
	 * 任务交接
	 *
	 */
	@RequestMapping(value = "/taskTransfer.do", method = { RequestMethod.GET })
	public ModelAndView taskTransfer(HttpServletRequest request,HttpServletResponse response){
		ModelAndView view = new ModelAndView("project/prjbscinfo/taskTransfer");
		return view;
	}

	/*
	 * 组织架构
	 *
	 */
	@RequestMapping(value = "/sysOrg.do", method = { RequestMethod.GET })
	public ModelAndView sysOrg(HttpServletRequest request,HttpServletResponse response){
		ModelAndView view = new ModelAndView("project/prjbscinfo/sysOrg");
		String type = request.getParameter("type");
		view.addObject("type", type);
		return view;
	}

	/*
	 * 保存任务交接处理人
	 *
	 */
	@RequestMapping(value = "/saveTaskTransfer.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object saveTaskTransfer(HttpServletRequest request,HttpServletResponse response){
		String ownerId = request.getParameter("ownerId");
		String assigneeId = request.getParameter("assigneeId");
		String assigneeName = request.getParameter("assigneeName");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,"修改成功!");
		MessageDTO<String> msgDTO = prjBscInfoService.saveTaskTransfer(ownerId,assigneeId,assigneeName);
		if(null != msgDTO){
			if(!msgDTO.isSuccess()){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(msgDTO.getMessage());
			}
		}else{
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("请求异常!!!");
		}

		return result;
	}


	/*
	 * 根据事业部获取经理列表
	 *
	 */
	@RequestMapping(value = "/showMgrListByOrgCd.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object showMgrListByOrgCd(HttpServletRequest request,
									 HttpServletResponse response){
		String orgCd = request.getParameter("orgCd");
		String refRlNm = request.getParameter("refRlNm");
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		/*if(orgCd.length()>8){
			orgCd = orgCd.substring(0, 8);
		}*/
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(pageSize)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		SysUsrQueryCondition qc = new SysUsrQueryCondition();
		qc.setOrgCd(orgCd);
		if(StringUtils.isNotEmpty(refRlNm)){
			qc.setRlNm(refRlNm);
		}
		/*List<SysUsrVO> actMgrList = this.prjBscInfoService
					.getCstMgrListByOrgId(orgCd);*/
		page.setCondition(qc);
		Pager pager = this.prjBscInfoService.getCstMgrListByOrgIdPage(page);
		List<SysUsrVO> list = (List<SysUsrVO>) pager.getResultList();
		ListPageVO<SysUsrVO> listPage = new ListPageVO<SysUsrVO>(list,
				pager.getTotalCount());
		return listPage;
		/*return actMgrList;*/
	}

	/*
	 * 业务转移保存
	 *
	 */
	@RequestMapping(value = "/saveMgrListByOrgCd.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object saveMgrListByOrgCd(HttpServletRequest request,
									 HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		String refRlNm = request.getParameter("refRlNm");
		String orgCd = request.getParameter("orgCd");
		String ids = request.getParameter("ids");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"修改成功!");
		if (StringUtils.isEmpty(id)||StringUtils.isEmpty(ids)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("参数不完整！");
			return result;
		}
		String[] prjIds = ids.split(",");
		try {
			for(String prjId :prjIds){
				if(!prjId.equals("")){
					PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
					Long cstId = prjBscInfoVO.getCstId();
					Long cstMgrId = prjBscInfoVO.getCstMgrId();
					String oldCstMgrNm=prjBscInfoVO.getCstMgrNm();//原客户经理
					String oldCstMgrOrgCd=prjBscInfoVO.getCstMgrOrgCd();//原组织架构
					prjBscInfoVO.setCstMgrId(Long.valueOf(id));
					prjBscInfoVO.setCstMgrNm(refRlNm);
					prjBscInfoVO.setCstMgrOrgCd(orgCd);
					prjBscInfoVO.setMdfType("YJ");

					this.prjBscInfoService.modifyPrjBscInfo(prjBscInfoVO);

					CapPayInfoQueryCondition cpCondition =new CapPayInfoQueryCondition();
					cpCondition.setPrjId(Long.valueOf(prjId));
					List<CapPayInfoVO> capPayInfoList = this.capPayInfoService.searchList(cpCondition);

					if(CollectionUtils.isNotEmpty(capPayInfoList)){
						for(CapPayInfoVO capPayInfoVO :capPayInfoList){
							capPayInfoVO.setCstMgrId(Long.valueOf(id));
							capPayInfoVO.setCstMgrNm(refRlNm);
							capPayInfoVO.setCstMgrOrgCd(orgCd);
							capPayInfoVO.setBuOrgCd(WebBaseUtils.getBuOrgCd(orgCd));
							this.capPayInfoService.modify(capPayInfoVO);
						}
					}

					InsPlcBscInfoQueryCondition ipbCondition = new InsPlcBscInfoQueryCondition();
					ipbCondition.setPrjId(Long.valueOf(prjId));
					GetInsPlcBscInfoListRequest getRequest = new GetInsPlcBscInfoListRequest(ipbCondition);
					logger.info("查询保单信息-request：{}", JSON.toJSONString(getRequest));
					ResponseData<List<InsPlcBscInfoDTO>> getResponse = this.insPlcBscInfoService.searchList(getRequest);
					logger.info("查询保单信息-result：{}", JSON.toJSONString(getResponse));
					if (null != getRequest && ResponseData.SUCCESS_CODE.equals(getResponse.getCode()) && CollectionUtils.isNotEmpty(getResponse.getData())){
						List<InsPlcBscInfoDTO> data = getResponse.getData();
						for (InsPlcBscInfoDTO dto : data) {
							ModifyInsPlcBscInfoRequest modifyRequest = new ModifyInsPlcBscInfoRequest();
							dto.setCstMgrId(Long.valueOf(id));
							dto.setCstMgrNm(refRlNm);
							dto.setCstMgrOrgCd(orgCd);
							dto.setBuOrgCd(WebBaseUtils.getBuOrgCd(orgCd));
							modifyRequest.setInsPlcBscInfoDTO(dto);
							ResponseData responseData = insPlcBscInfoService.modifyInsPlcBscInfo(modifyRequest);
							logger.info("修改保单信息，dto:{},response:{}", JSON.toJSONString(dto), JSON.toJSONString(responseData));
						}
					}

					CstUsrRQueryCondition curCondition = new CstUsrRQueryCondition();
					curCondition.setCstId(cstId);
					curCondition.setOpUsrId(Long.valueOf(id));
					curCondition.setOrgCd(orgCd);
					List<CstUsrRVO> curList = this.cstUsrRService.searchList(curCondition);
					if(CollectionUtils.isNotEmpty(curList)){
						for(CstUsrRVO cstUsrRVO :curList){
							cstUsrRVO.setOrgCd(orgCd);
							cstUsrRVO.setOpTm(new Date());
							this.cstUsrRService.modify(cstUsrRVO);
						}
					}else{
						CstUsrRVO cstUsrRVO = new CstUsrRVO();
						cstUsrRVO.setCstId(cstId);
						cstUsrRVO.setOrgCd(orgCd);
						cstUsrRVO.setOpTm(new Date());
						cstUsrRVO.setOpUsrId(Long.valueOf(id));
						this.cstUsrRService.add(cstUsrRVO);
					}
					// REQ-4030 add by gengchunlan 20190708
					String contractNo=prjBscInfoVO.getLsCntNo(); //原合同号
					if(StringUtils.isNotBlank(contractNo)) {
						//权证管理客户经理信息项目所属变更  start -----------
						//权证 归档
						  ArcMgrMainQC qc =new ArcMgrMainQC();
						  qc.setContractNo(contractNo);
						  List<ArcMgrMainDTO> mgrList=arcMgrMainApiService.selectList(qc);
						  if(mgrList!=null && mgrList.size()>0){
							  for(ArcMgrMainDTO mgrVo: mgrList){
								  if(mgrVo!=null) {
									  //过滤 判断与当前合同号相等
									  String mCno=mgrVo.getContractNo();
									  if(contractNo.equals(mCno)) {
										  mgrVo.setCstMgrId(Long.valueOf(id));
										  mgrVo.setCstMgrNm(refRlNm);
										  mgrVo.setCstMgrOrgCd(orgCd);
										  mgrVo.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
										  mgrVo.setMdfTm(new Date());
										  arcMgrMainApiService.modify(mgrVo);
									  }
								  }
							  }
							  logger.info("transferMgr:{}", JSON.toJSONString(mgrList));
						  }
					      //权证 借阅
						  ArcBorrowMainQueryCondition qc2=new ArcBorrowMainQueryCondition();
						  qc2.setContractNo(contractNo);
						  List<ArcBorrowMainVO> bolist =this.arcBorrowMainService.selectList(qc2);
						  if (bolist != null && bolist.size() > 0) {
							for (ArcBorrowMainVO bo : bolist) {
								if (bo != null) {
									 //过滤 判断与当前合同号相等
									String cNo=bo.getContractNo();
									if(contractNo.equals(cNo)) {
										//过滤一下客户经理ID一致
										if(StringUtils.isNotEmpty(cstMgrId) && StringUtils.isNotEmpty(bo.getCstMgrId()) &&
												(cstMgrId.equals(bo.getCstMgrId()))) {
											bo.setCstMgrId(Long.valueOf(id));
											bo.setCstMgrNm(refRlNm);
											bo.setCstMgrOrgCd(orgCd);
											bo.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
											bo.setMdfTm(new Date());
											arcBorrowMainService.update(bo);
										}
									}
								}
							}
							logger.info("transferBw:{}", JSON.toJSONString(bolist));
						  }
						//权证 结清移交
						ArcTransferMainQueryCondition qc3=new ArcTransferMainQueryCondition();
						qc3.setContractNo(contractNo);
						Pager page3=new Pager();
						page3.setEveryPage(100);
						page3.setCurrentPage(0);
						page3.setCondition(qc3);
						page3=this.arcTransferMainService.searchListPage(page3);
						List<ArcTransferMainDTO> trlist = (List<ArcTransferMainDTO>) page3.getResultList();
						if(trlist!=null && trlist.size()>0){
							for(ArcTransferMainDTO trVo:trlist) {
								if(trVo!=null) {
									 //过滤 判断与当前合同号相等
									String cNo=trVo.getContractNo();
									if(contractNo.equals(cNo)) {
										//过滤一下客户经理ID
										if(StringUtils.isNotEmpty(cstMgrId) && StringUtils.isNotEmpty(trVo.getCstMgrId()) &&
												(cstMgrId.equals(trVo.getCstMgrId()))) {
											trVo.setCstMgrId(Long.valueOf(id));
											trVo.setCstMgrNm(refRlNm);
											trVo.setCstMgrOrgCd(orgCd);
											trVo.setMdfTm(new Date());
											trVo.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
											this.arcTransferMainService.update(ArcTransferMainVOTransform.toVO(trVo));
										}
									}
								}
							}
							logger.info("trVo:{}", JSON.toJSONString(trlist));
						}
						//权证管理客户经理信息项目所属变更  end by gengchunlan-----------
						//借款信息交接，只需交接未核销费用信息数据 add by gengchunlan 20190709
						Pager page4=new Pager();
						page4.setEveryPage(50);
						page4.setCurrentPage(0);
						FinLoanInfoQC qc4 = new FinLoanInfoQC();
						qc4.setContNo(contractNo);
						qc4.setMinArAmt(0l);//传0  就是查大于0
						page4.setCondition(qc4);
						Pager pager4 = this.finLoanInfoService.selectLoanPayPage(page4);
						List<FinLoanInfoDTO> fllist = (List<FinLoanInfoDTO>) pager4.getResultList();
						if (fllist!=null && fllist.size()>0) {
							for(FinLoanInfoDTO floan:fllist){
						    	if(floan!=null  && (floan.getArAmt()!=null)) {//未核销
						    		String contNo=floan.getContNo();
						    		//判断一下是否与当前合同号相等  过滤
						    		if(contractNo.equals(contNo)){
						    			//根据旧的客户经理ID查询原所属项目经理工号信息
						    			SysUsrDTO	userDto=sysUsrApiService.selectSysUsrById(Long.valueOf(cstMgrId), CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
						    			String gong="";
						    			if(userDto!=null && !"".equals(userDto.getUsrNm()) && null!=userDto.getUsrNm()) {
						    				gong=userDto.getUsrNm();
						    			}
						    			//根据借款人工号过滤
										if(StringUtils.isNotBlank(gong) && StringUtils.isNotBlank(floan.getCstMgrCd()) &&
												(gong.equals(floan.getCstMgrCd()))) {
							    			FinLoanInfoVO finVo=new FinLoanInfoVO();
							    			finVo.setId(floan.getId());
							    			finVo.setCstMgrId(Long.valueOf(id));
							    			finVo.setCstMgrNm(refRlNm);
							    			finVo.setCstMgrOrgCd(orgCd);
							    			//根据新的客户经理ID查询新所属项目经理工号信息
							    			SysUsrDTO	userDtoN=sysUsrApiService.selectSysUsrById(Long.valueOf(id), CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
							    			String gongN="";
							    			if(userDtoN!=null && !"".equals(userDtoN.getUsrNm()) && null!=userDtoN.getUsrNm()) {
							    				gongN=userDtoN.getUsrNm();
							    				finVo.setCstMgrCd(gongN);
							    			}
							    			finVo.setMdfTm(new Date());
							    			finVo.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
											finLoanInfoService.modify(finVo);
										}//end 根据借款人工号过滤
						    		}
								}
						    	logger.info("floanV:{}", JSON.toJSONString(fllist));
						    }
			            }
						//end 借款信息交接
					}//end if contractNo
					//项目移交记录 add by gengchunlan 20190709
					if(prjBscInfoVO!=null) {
						PrjTransferInfoVO vo= new PrjTransferInfoVO();
						vo.setPrjId(Long.parseLong(prjId));// 项目ID
						vo.setPrjNm(prjBscInfoVO.getPrjNm());//项目名称
						vo.setContractNo(prjBscInfoVO.getLsCntNo());//合同号
						vo.setCstMgrId(Long.valueOf(id));//新客户经理ID
						vo.setCstMgrNm(refRlNm);//新客户经理名称
						vo.setCstMgrOrgCd(orgCd);//新客户经理组织架构
						vo.setOldCstMgrId(cstMgrId);//原客户经理ID
						vo.setOldCstMgrNm(oldCstMgrNm);//原客户经理名称
						vo.setOldCstMgrOrgCd(oldCstMgrOrgCd);//原客户经理组织架构
						vo.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
						vo.setCrtUsrNm(CurrentThreadContext.getCurrentUserName());
						logger.info("saveTransferVo:{}", JSON.toJSONString(vo));
						prjTransferInfoService.add(vo);//保存到数据库
					}//end by gengchunlan 20190709

					logger.info("prjId="+prjId+";原客户经理ID="+cstMgrId+"--->新客户经理ID="+id);
					
					/*SysFlowAgentUsrVO sysFlowAgentUsrVO = new SysFlowAgentUsrVO();
					sysFlowAgentUsrVO.setProcessDefKey("*");
					sysFlowAgentUsrVO.setEntrustUsrId(Long.valueOf(id));
					sysFlowAgentUsrVO.setStartTm(new Date());
					sysFlowAgentUsrVO.setEndTm(DateUtils.getDateAddDate(new Date(),1,20));
					sysFlowAgentUsrVO.setUsrId(CurrentThreadContext.getCurrentUserId());
					sysFlowAgentUsrVO.setSysCd(CurrentThreadContext.getCurrentSysCd());
					
					Boolean pass = this.flowService.addFlowAgentUsr(sysFlowAgentUsrVO);
					if(null == pass || pass == false){
						result.setSuccess(BaseConstant.IS_YESNO_NO);
						result.setInfo("流程操作失败！");
					}*/
				}
			}
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("修改失败,msg:{}", ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("修改失败!");
			logger.error("修改失败,msg:{}", ex.getMessage());
		}
		return result;
	}

	/**
	 * @description 账号变更(区分供应商，承租人，担保人)
	 * @author sunqian
	 */
    @RequestMapping(value = "/changePro.do", method = { RequestMethod.GET })
    public ModelAndView changePro(HttpServletRequest request,
                                  HttpServletResponse response){
        String id = request.getParameter("id");
        PrjPrdBscInfoVO prdBscInfoVO = this.prjPrdBscInfoService.getPrjPrdBscInfoById(Long.valueOf(id));
        String payeeTypCd = prdBscInfoVO.getReceiveTypeCd() == null ? "" : prdBscInfoVO.getReceiveTypeCd();
        CapPayeeInfoQueryCondition condition = new CapPayeeInfoQueryCondition();
        condition.setPrjPrdId(Long.valueOf(id));
        List<CapPayeeInfoVO> result=this.capPayeeInfoService.searchListByPrjPrd(condition);
        PrjSplBankAccRQueryCondition accQc = new PrjSplBankAccRQueryCondition();
        //accQc.setPurpCd(PrjPrdBscInfoConstant.SPL_BANK_NO_TP);
        accQc.setPrjPrdId(Long.valueOf(id));
        List<PrjSplBankAccRVO> splBankAccRVOList = 	this.prjSplBankAccRService.searchList(accQc);
        Long accId = null;
        String accNo = "";
        Long cstId = null;
        List<KeyValueVO> purpCdList = this.prdSplBankService.searchPurpCdList();
        List<KeyValueVO> purpCds = new ArrayList<>();
        if(CollectionUtils.isNotEmpty(splBankAccRVOList)){
            for (PrjSplBankAccRVO prjSplBankAccRVO : splBankAccRVOList) {
                if(PrjPrdBscInfoConstant.SPL_BANK_NO_TP.equals(prjSplBankAccRVO.getPurpCd())){
                    accId = prjSplBankAccRVO.getSplAccNoId();
                }
                for (KeyValueVO keyValueVO : purpCdList) {
                    if (prjSplBankAccRVO.getPurpCd().equals(keyValueVO.getKey())) {
                        purpCds.add(keyValueVO);
                    }
                }
            }
        }
        Collections.sort(purpCds, new Comparator<KeyValueVO>() {
            public int compare(KeyValueVO o1, KeyValueVO o2) {
                return o1.getKey().compareTo(o2.getKey());
            }
        });
        SplBankVO splBankVO = null;
        if(accId!=null){
            splBankVO = this.splBankService.selectById(accId);
            if(splBankVO != null){
                accNo = splBankVO.getAccNo();
            } else {
                CstBankDTO cstBankDTO = this.customerApiService.selectCstBankById(accId);
                cstId = cstBankDTO.getCstId();
                accNo = cstBankDTO.getAccNo();
            }
        }
        List<KeyValueVO> receiveList = this.prdSplBankService.searchPayeeTypCdList();
        String payeeTypCdNm = "";
        for (KeyValueVO keyValueVO : receiveList) {
            if (keyValueVO.getKey().equals(payeeTypCd)) {
                payeeTypCdNm = keyValueVO.getValue();
                break;
            }
        }
        Long accIdFl = null;
        String accNoFl = "";
        Long accIdFlGps = null;
        String accNoFlGps = "";
        if(CollectionUtils.isNotEmpty(result)){
            for(CapPayeeInfoVO capPayeeInfoVO : result){
                if(StringUtils.isNotBlank(capPayeeInfoVO.getPurpCd())){
                    if((capPayeeInfoVO.getPurpCd()).equals("2")){
                        accIdFl = capPayeeInfoVO.getBkId();
                        accNoFl = capPayeeInfoVO.getAccNo();
                    }else if((capPayeeInfoVO.getPurpCd()).equals("11")){
                        accIdFlGps = capPayeeInfoVO.getBkId();
                        accNoFlGps = capPayeeInfoVO.getAccNo();
                    }
                }
            }
        }
        ModelAndView view = new ModelAndView("project/prjbscinfo/changePro");
        view.addObject("prjPrdId", id);
        view.addObject("prdBscInfoVO", prdBscInfoVO);
        view.addObject("purpCdList", purpCds);
        view.addObject("splId", prdBscInfoVO.getSplId());
        view.addObject("splNm", prdBscInfoVO.getSplNm());
        view.addObject("accId", accId);
        view.addObject("accNo", accNo);
        view.addObject("accIdFl", accIdFl);
        view.addObject("accNoFl", accNoFl);
        view.addObject("accIdFlGps", accIdFlGps);
        view.addObject("accNoFlGps", accNoFlGps);
        view.addObject("payeeTypCdNm", payeeTypCdNm);
        view.addObject("payeeTypCd", payeeTypCd);
        view.addObject("cstId", cstId);
		return view;
	}

	/**
	 * @description 变更账号保存
	 * @author sunqian
	 */
	@RequestMapping(value = "/saveChangePro.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object saveChangePro(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        logger.info("变更账号保存入参request:{}", JSONObject.toJSONString(this.getRequestParameter(request)));
		String prjPrdId = request.getParameter("prjPrdId");
		String purpCd = request.getParameter("purpCd");
		String splId = request.getParameter("splId");
		String splNm = request.getParameter("splNm");
		String splAccNoId = request.getParameter("splAccNoId");
		String payeeTypCd = request.getParameter("payeeTypCd");
		String accNo = request.getParameter("accNo");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "修改成功!");
		if (StringUtils.isEmpty(prjPrdId)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("参数不完整！");
			return result;
		}
		CapPayeeInfoQueryCondition cpeCondition = new CapPayeeInfoQueryCondition();
		cpeCondition.setPrjPrdId(Long.valueOf(prjPrdId));
		List<CapPayeeInfoVO> capPayeeInfoList = this.capPayeeInfoService.searchListByPrjPrd(cpeCondition);
        logger.info("变更账号保存查询capPayeeInfoList:{}", JSONObject.toJSONString(capPayeeInfoList));
        CapPayInfoQueryCondition cpCondition =new CapPayInfoQueryCondition();
		cpCondition.setPrjPrdId(Long.valueOf(prjPrdId));
		List<CapPayInfoVO> capPayInfoList = this.capPayInfoService.searchList(cpCondition);
        logger.info("变更账号保存查询capPayInfoList:{}", JSONObject.toJSONString(capPayInfoList));
		try {
            //查询供应商账号信息
            PrjSplBankAccRQueryCondition qc = new PrjSplBankAccRQueryCondition();
            qc.setPrjPrdId(Long.valueOf(prjPrdId));
            List<PrjSplBankAccRVO> splBankAccRVOList = this.prjSplBankAccRService.searchList(qc);
            logger.info("变更账号保存查询splBankAccRVOList:{}", JSONObject.toJSONString(splBankAccRVOList));
            if (CollectionUtils.isNotEmpty(splBankAccRVOList)) {
                for (PrjSplBankAccRVO splBankAccRVO : splBankAccRVOList) {
                    if (splBankAccRVO.getPurpCd().equals(purpCd)) {
                        splBankAccRVO.setSplAccNoId(Long.valueOf(splAccNoId));
                        splBankAccRVO.setMdfTm(new Date());
                        splBankAccRVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                        logger.info("变更账号保存1splBankAccRVO:{}", JSONObject.toJSONString(splBankAccRVO));
                        prjSplBankAccRService.modify(splBankAccRVO);
                    }
                }
            }
            PrjPrdBscInfoVO prdBscInfoVO = new PrjPrdBscInfoVO();
            prdBscInfoVO.setId(Long.valueOf(prjPrdId));
            prdBscInfoVO.setSplId(Long.valueOf(splId));
            prdBscInfoVO.setSplNm(splNm);
            prdBscInfoVO.setMdfTm(new Date());
            prdBscInfoVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
            logger.info("变更账号保存2prdBscInfoVO:{}", JSONObject.toJSONString(prdBscInfoVO));
            this.prjPrdBscInfoService.modify(prdBscInfoVO);
			if (CollectionUtils.isNotEmpty(capPayInfoList)) {
				for (CapPayInfoVO capPayInfoVO : capPayInfoList) {
					capPayInfoVO.setSplId(Long.valueOf(splId));
					capPayInfoVO.setSplNm(splNm);
					capPayInfoVO.setMdfTm(new Date());
					capPayInfoVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                    logger.info("saveChangePro,变更账号保存3capPayInfoVO:{}", JSONObject.toJSONString(capPayInfoVO));
					capPayInfoService.modify(capPayInfoVO);
				}
			}
			if (CapitalConstant.CODE_PAYEE_TYP_CD_1.equals(payeeTypCd)) {
				if (CollectionUtils.isNotEmpty(capPayeeInfoList)) {
					SplBankVO splBankVO = prdSplBankService.selectById(Long.valueOf(splAccNoId));
                    logger.info("saveChangePro,变更账号保存查询splBankVO:{}", JSONObject.toJSONString(splBankVO));
                    for (CapPayeeInfoVO capPayeeInfoVO : capPayeeInfoList) {
					    if (capPayeeInfoVO.getPurpCd().equals(purpCd)) {
                            capPayeeInfoVO.setBkId(Long.valueOf(splAccNoId));
                            capPayeeInfoVO.setAccNo(accNo);
                            capPayeeInfoVO.setRcptUnt(splBankVO.getRcptUnt());
                            capPayeeInfoVO.setPayeeBkNo(splBankVO.getBkNo());
                            capPayeeInfoVO.setPayeeBkNm(splBankVO.getBkNm());
                            capPayeeInfoVO.setBkAccTypCd(splBankVO.getBizTypCd());
                            capPayeeInfoVO.setMdfTm(new Date());
                            capPayeeInfoVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                            logger.info("saveChangePro,变更账号保存4capPayeeInfoVO:{}", JSONObject.toJSONString(capPayeeInfoVO));
                            this.capPayeeInfoService.modify(capPayeeInfoVO);
                        }
					}
				}
			} else if (CapitalConstant.CODE_PAYEE_TYP_CD_2.equals(payeeTypCd) || CapitalConstant.CODE_PAYEE_TYP_CD_8.equals(payeeTypCd)) {
				//查询收款账户
                if (CollectionUtils.isNotEmpty(capPayeeInfoList)) {
                    CstBankVO cstBankVO = this.cstBankService.selectById(Long.parseLong(splAccNoId));
                    logger.info("saveChangePro,变更账号保存查询cstBankVO:{}", JSONObject.toJSONString(cstBankVO));
                    for (CapPayeeInfoVO capPayeeInfoVO : capPayeeInfoList) {
                        if (purpCd.equals("1") && (capPayeeInfoVO.getPurpCd()).equals("1")) {
                            capPayeeInfoVO.setBkId(cstBankVO.getId());//收款方账号ID
                            capPayeeInfoVO.setAccNo(cstBankVO.getAccNo());//收款账号
                            capPayeeInfoVO.setRcptUnt(cstBankVO.getAccNm());//收款单位/人
                            //收款账号类型映射
                            List<SysDictionaryDTO> accTypCdList=this.sysDictionaryApiService.searchGroup(CapitalConstant.SYSCD, CapitalConstant.SYSORG,
                                    CapitalConstant.CODE_CST_BK_ACC_TYP_CD);
                            Map<String,String> accTypCdMap=null;
                            if(CollectionUtils.isNotEmpty(accTypCdList)){
                                accTypCdMap=new HashMap<>(accTypCdList.size());
                                for(SysDictionaryDTO dict:accTypCdList){
                                    accTypCdMap.put(dict.getCode(),dict.getCodeAttr2());
                                }
                            }
                            capPayeeInfoVO.setBkAccTypCd(accTypCdMap.get(cstBankVO.getAccTypCd()));//对公/对私
                            SysDictionaryDTO dict=this.sysDictionaryApiService.getCode(CapitalConstant.SYSCD, CapitalConstant.SYSORG,
                                    CapitalConstant.CODE_CAP_BK_CD,cstBankVO.getBkCd());
                            if(dict!=null){
                                capPayeeInfoVO.setPayeeBkNm(dict.getCodeNm());//开户银行名称
                            }
                            capPayeeInfoVO.setPayeeBkNo(cstBankVO.getBkNo());//收款方银行开户行号
                            capPayeeInfoVO.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                            this.capPayeeInfoService.modify(capPayeeInfoVO);
                            logger.info("saveChangePro,变更账号保存5capPayeeInfoVO:{}", JSONObject.toJSONString(capPayeeInfoVO));
                        }
                    }
                }
			} else {
				throw new BaseException("暂不支持此放款类型修改");
			}
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("修改失败,msg:{}", ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("修改失败!");
			logger.error("修改失败,msg:{}", ex.getMessage());
		}
		return result;
	}

	/**
	 * 到列表页面
	 */
	@RequestMapping(value = "/toChoosePrjCstPage.do", method = { RequestMethod.GET })
	public ModelAndView toChoosePrjCstPage(HttpServletRequest request,
										   HttpServletResponse response) {
		logger.info("加载选择客户列表页面.");
		String cstRlFlag = request.getParameter("cstRlFlag");
		String cstTypCd = request.getParameter("cstTypCd");
		ModelAndView view = new ModelAndView(
				"project/prjCstInfo/cstBscInfoList");
		List<KeyValueVO> cststscdlist = this.cstBscInfoService
				.searchCstStsCdList();
		view.addObject("searchSelectCststscdlist", cststscdlist);
		// 客户类型
		List<KeyValueVO> csttypcdlist = this.cstBscInfoService
				.searchCstTypCdList();
		view.addObject("searchSelectCsttypcdlist", csttypcdlist);
		// 事业部
		List<KeyValueVO> orgList = this.cstBscInfoService
				.searchBusinessOrgList();
		view.addObject("orgListList", orgList);
		// 客户关系属性
		List<KeyValueVO> cstRlTypCdList = this.cstBscInfoService
				.searchCstRlTypList();
		view.addObject("cstRlTypCdList", cstRlTypCdList);
		// 查询项要有默认值,这里给出默认值到前端页面显示
		view.addObject("currentBuOrgCd",
				CurrentThreadContext.getCurrentBuOrgCd());
		view.addObject("currentCstRlType",
				DictionaryConstant.CODE_GRP_CST_RL_TYP_CD_1);
		view.addObject("cstRlFlag", cstRlFlag);
		view.addObject("cstTypCd", cstTypCd);
		return view;
	}

    /**
     * 到预筛选记录页面
     */
    @RequestMapping(value = "/toChooseMecPage.do", method = { RequestMethod.GET })
    public ModelAndView toChooseMecPage(HttpServletRequest request,HttpServletResponse response){
        logger.info("加载预筛选记录页面.");
		//业务线字典List
		List<KeyValueVO> bussinessLineDicList = sysDictionaryApiService.getKvList("REF0048","11000","0000");
		//机构信息List
		List<FriBaseInfoVO> friBaseInfoVOList = this.friBaseInfoService.searchList(new FriBaseInfoQueryCondition());
		//根据金融机构业务线,设置金融机构名称展示字段值
		FundRasInsNmChangeUtil.insNmShowAddBussinessLineDic(friBaseInfoVOList,bussinessLineDicList);
        ModelAndView view = new ModelAndView("project/preInsInfo/preInsInfoList");
        String cstId = request.getParameter("cstId");
        String prjTypCd = request.getParameter("prjTypCd");
        view.addObject("cstId",cstId);
        view.addObject("prjTypCd",prjTypCd);
		view.addObject("friBaseList", friBaseInfoVOList);
		return view;
    }

    /**
     * 预筛选记录页面初始化
     */
    @RequestMapping(value = "/preInsInfoInitList.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initCapFundList(HttpServletRequest request, HttpServletResponse response){
        logger.info("预筛选记录页面初始化.");
        String currentPage = request.getParameter("page");
        String pageSize = request.getParameter("pagesize");
        String cstId = request.getParameter("cstId");//客户id
        String prjTypCd = request.getParameter("prjTypCd");//项目类型
        String cstMgrNm = request.getParameter("cstMgrNm");//客户经理
        String crtTmStart = request.getParameter("crtTmMin");//创建开始时间
        String crtTmEnd = request.getParameter("crtTmMax");//创建结束时间

        Pager page = new Pager();
        if (StringUtils.isNotEmpty(currentPage)) {
            page.setCurrentPage(Integer.parseInt(currentPage));
        }
        if (StringUtils.isNotEmpty(pageSize)) {
            page.setEveryPage(Integer.parseInt(pageSize));
        }
        PreRouteBscInfoQC qc = new PreRouteBscInfoQC();
        if(StringUtils.isNotEmpty(cstId)){
            qc.setCstId(Long.valueOf(cstId));
        }
        if(StringUtils.isNotEmpty(prjTypCd)){
            qc.setPrjTypCd(prjTypCd);
        }
        if(StringUtils.isNotEmpty(cstMgrNm)){
            qc.setCstMgrNm(cstMgrNm);
        }else{
            qc.setCstMgrId(CurrentThreadContext.getCurrentUserId());
        }
        if(StringUtils.isNotEmpty(crtTmStart)){
            qc.setCrtTmStart(DateUtils.formatStringToDate(crtTmStart, DateUtils.YYYY_MM_DD));
        }
        if(StringUtils.isNotEmpty(crtTmEnd)){
            qc.setCrtTmEnd(new Date(DateUtils.formatStringToDate(crtTmEnd, DateUtils.YYYY_MM_DD).getTime() + 24*60*60*1000));
        }
        qc.setBuOrgCd(CurrentThreadContext.getCurrentBuOrgCd());
        page.setCondition(qc);
        logger.info("preInsInfoInitList,预筛选记录查询参数 page:{}", JSONObject.toJSONString(page));
        Pager pager = this.preRouteQueryApiService.selectPreRouteBscInfoListPageWithResult(page);
        logger.info("preInsInfoInitList,预筛选记录查询结果 pager:{}", JSONObject.toJSONString(pager));
        List<PreRouteBscInfoVO> list=null;
        if(pager!=null){
            list = (List<PreRouteBscInfoVO>) pager.getResultList();
        }
        ListPageVO<PreRouteBscInfoVO> listPage = new ListPageVO<PreRouteBscInfoVO>(list, pager.getTotalCount());
        return listPage;
    }

    /**
     * 通过预筛选ID查询预筛选结果信息
     */
    @RequestMapping(value = "/preInsResInfoInitList.do", method = {RequestMethod.GET})
    @ResponseBody
    public ListPageVO preInsResInfoInitList(Long id){
        ListPageVO res = null;
        BaseParamDTO baseParamDTO = new BaseParamDTO();
        logger.info("preInsResInfoInitList,预筛选结果查询参数 id:{}",id);
        PreRouteBscInfoVO preRouteBscInfoVO = PreRouteBscInfoVOTransform.toVO(this.preRouteQueryApiService.selectPreRouteBscInfoAllById(id,baseParamDTO));
        logger.info("preInsResInfoInitList,预筛选结果结果 result:{}",JSONObject.toJSONString(preRouteBscInfoVO));
        if(null != preRouteBscInfoVO){
            List<PreRouteInsResVO> preRouteInsResVOList = preRouteBscInfoVO.getPreRouteInsResVOS();
            if(CollectionUtils.isNotEmpty(preRouteInsResVOList)){
                res = new ListPageVO(preRouteInsResVOList,preRouteInsResVOList.size());
            }
        }
        return res;
    }

	/**
	 * 到列表页面
	 */
	@RequestMapping(value = "/toChoosePrjFundPage.do", method = { RequestMethod.GET })
	public ModelAndView toChoosePrjFundPage(HttpServletRequest request,
											HttpServletResponse response) {
		logger.info("加载选择机构列表页面.");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/fundBscInfoList");
		String prjTypCd = request.getParameter("prjTypCd");//项目类型
		view.addObject("prjTypCd", prjTypCd);
		return view;
	}

	/**
	 * 机构列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initFundList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initFundList(HttpServletRequest request,
							   HttpServletResponse response) {
		String fundRasInsNm = request.getParameter("fundRasInsNm");
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		FriBaseInfoQueryCondition qc = new FriBaseInfoQueryCondition();
		if (StringUtils.isNotEmpty(fundRasInsNm)) {
			qc.setFundRasInsNm(fundRasInsNm);  //金融机构名称  模糊查询
		}
		qc.setInsSts(FriBaseInfoConstant.FRI_BASE_INFO_INS_STS_PASS);
		qc.setInsUseCd("2");
		// 只展示提供服务的机构
		qc.setIsService(1);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		page.setCondition(qc);
		Pager pager = this.friBaseInfoService.searchListPage(page);
		logger.info("initFundList,金融机构列表:{}" ,JSONObject.toJSONString(pager));
		List<FriBaseInfoVO> list = (List<FriBaseInfoVO>) pager.getResultList();
		ListPageVO<FriBaseInfoVO> listPage = new ListPageVO<FriBaseInfoVO>(list,
				pager.getTotalCount());
		return listPage;
	}

	/**
	 * 删除数据
	 */
	@RequestMapping(value = "/removeByIds.do", method = { RequestMethod.POST })
	@ResponseBody
	public DataResultVO removeByIds(HttpServletRequest request,
									HttpServletResponse response) throws BaseException {
		String ids = request.getParameter("ids");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				SysLogConstant.LOG_CMM_DELETE_SUCC);
		if (StringUtils.isEmpty(ids)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			return result;
		}
		List<Long> idList = new ArrayList<Long>();
		JSONArray idsArray = JSONArray.fromObject(ids);
		for (Object object : idsArray) {
			idList.add(Long.valueOf(object.toString()));
		}
		try {
			this.prjBscInfoService.removeByIds(idList,CurrentThreadContext.getCurrentUserId());
			logger.info("removeById,删除数据.id:{},操作人:{}",ids ,CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("removeById,删除数据失败.id:{},msg:{},操作人:{}",ids ,ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			logger.error("删除数据失败.ids:{},msg:{},操作人:{}",ids,ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	// ---------------------------项目资信-------------------------------------------//
	/**
	 * 到资信添加页面-new
	 */
	@RequestMapping(value = "/toPrjInvestAddPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjInvestAddPage(HttpServletRequest request,
										   HttpServletResponse response) {
		logger.info("加载toPrjInvestRptPage 页面.");
		String prjId = request.getParameter("prjId");// 项目ID
		String detailFlag = request.getParameter("detailFlag");// 项目ID
		String cstRlCd = request.getParameter("cstRlCd");// 客户关系

		//********流程参数开始********//
		String preTaskIds = request.getParameter("preTaskIds");//流程上一个节点任务ID,多个以逗号分割.
		String pInstId = request.getParameter("pInstId");//流程实例ID
		//********流程参数结束********//
		List<KeyValueVO> genderCdList = this.cstBscInfoService
				.searchGenderCdList();
		List<KeyValueVO> rlCdList = this.prjBscInfoService.getRlCdList();
		CstBscInfoVO cstBscInfoVO = null;
		String cstType = "";
		Long cstId = null;
		if (StringUtils.isNotBlank(prjId)) {
			cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
					.valueOf(prjId));
			if (null != cstBscInfoVO) {
				cstType = cstBscInfoVO.getCstTypCd();
				cstId = cstBscInfoVO.getId();
			}
		}
		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		// 查承租人照片配置信息
		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_NP);
			qc.setCfgCdList(codeList);
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_LP);
			qc.setCfgCdList(codeList);
		}
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long
				.valueOf(prjId));
		if (null != prjBsc) {
			orgCd = prjBsc.getBuOrgCd();
		}
		PrjCstInvestRptVO rpt = null;
		if (StringUtils.isNotBlank(prjId) && null != cstId) {
			rpt = this.prjCstInvestRptService
					.getPrjCstInvestRptByPrjIdAndCstId(Long.valueOf(prjId),
							cstId, cstRlCd);// 通过项目和客户id查询客户调查报告
		}
		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		SysUlDatCfgVO cfg = null;
		if (CollectionUtils.isNotEmpty(list)) {
			cfg = list.get(0);
		}
		List<SysUlDatCfgDtlVO> dtlList = cfg.getSysUlDatCfgDtlVOList();
		List<SysUlFilesRecVO> dtlFileList = new ArrayList<SysUlFilesRecVO>();
		if (CollectionUtils.isNotEmpty(dtlList)) {
			for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : dtlList) {
				SysUlFilesRecQueryCondition ulFileQc = new SysUlFilesRecQueryCondition();
				ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
				ulFileQc.setSysCd(qc.getSysCd());
				ulFileQc.setOrgCd(orgCd);
				ulFileQc.setPkId(prjId);
				ulFileQc.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
				ulFileQc.setTabNm("PRJ_BSC_INFO");
				List<SysUlFilesRecVO> fileList = sysUlFilesRecService
						.searchList(ulFileQc);
				if (CollectionUtils.isNotEmpty(fileList)) {
					// sysUlDatCfgDtlVO.setFileRecList(fileList);
					for (SysUlFilesRecVO sysUlFilesRecVO : fileList) {
						sysUlFilesRecVO.setCfgCd(qc.getCfgCdList().get(0));
						sysUlFilesRecVO.setSysCd(sysUlDatCfgDtlVO.getSysCd());
						sysUlFilesRecVO.setOrgCd(sysUlDatCfgDtlVO.getOrgCd());
						sysUlFilesRecVO.setCfgDtlCd(sysUlDatCfgDtlVO
								.getCfgDtlCd());
						sysUlFilesRecVO.setDatNm(sysUlDatCfgDtlVO.getDatNm());
						dtlFileList.add(sysUlFilesRecVO);
					}
				} else {
					SysUlFilesRecVO filesRecVO = new SysUlFilesRecVO();
					filesRecVO.setCfgCd(qc.getCfgCdList().get(0));
					filesRecVO.setSysCd(sysUlDatCfgDtlVO.getSysCd());
					filesRecVO.setOrgCd(sysUlDatCfgDtlVO.getOrgCd());
					filesRecVO.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
					filesRecVO.setDatNm(sysUlDatCfgDtlVO.getDatNm());
					dtlFileList.add(filesRecVO);
				}
			}
			//
		}
		String serverPath = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_SERVER_PATH);// 服务地址
		String customerPah = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_COSTOMER_PATH);
		String headPic = PropertiesCacheUtils
				.getProperty(fl.constant.facade.framework.constant.UploadConstant.DEFAULT_NO_PIC);
		// 客户类型
		ModelAndView view = new ModelAndView(
				"project/prjcstinvestrptinfo/prjCstInvestRptInfoAdd");
		view.addObject("genderCdList", JSON.toJSONString(genderCdList));
		view.addObject("rlCdList", JSON.toJSONString(rlCdList));
		view.addObject("prjId", prjId);
		view.addObject("detailFlag", detailFlag);
		view.addObject("cstRlCd", cstRlCd);
		view.addObject("dtlList", dtlFileList);
		view.addObject("defImg", serverPath + customerPah + headPic);
		view.addObject("cstType", cstType);
		view.addObject("cstId", cstId);
		view.addObject("pInstId", pInstId);
		view.addObject("preTaskIds", preTaskIds);
		view.addObject("prjCstInvestRpt", rpt);
		return view;
	}

	/**
	 * 到担保人考察照片页面-new
	 */
	@RequestMapping(value = "/toGuarPhotosListPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toGuarPhotosListPage(HttpServletRequest request,
											 HttpServletResponse response) {
		logger.info("加载toPrjInvestRptPage 页面.");

		String prjCstId = request.getParameter("prjCstId");
		String detailFlag = request.getParameter("detailFlag");
		String cstTypCd = request.getParameter("cstTypCd");// 分类
		String prjId = request.getParameter("prjId");// 项目ID
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long
				.valueOf(prjId));
		if (null != prjBsc) {
			orgCd = prjBsc.getBuOrgCd();
		}
		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		if (cstTypCd.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_GUAR_SURVEY_PHOTO_NP);
			qc.setCfgCdList(codeList);
		}
		if (cstTypCd.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_GUAR_SURVEY_PHOTO_LP);
			qc.setCfgCdList(codeList);
		}
		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		SysUlDatCfgVO cfg = null;
		if (CollectionUtils.isNotEmpty(list)) {
			cfg = list.get(0);
		}
		List<SysUlDatCfgDtlVO> dtlList = cfg.getSysUlDatCfgDtlVOList();
		List<SysUlFilesRecVO> dtlFileList = new ArrayList<SysUlFilesRecVO>();
		/*
		 * SysUlFilesRecQueryCondition ulFileQc = new
		 * SysUlFilesRecQueryCondition();
		 * ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
		 * ulFileQc.setSysCd(qc.getSysCd());
		 * ulFileQc.setOrgCd(PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG);
		 * ulFileQc.setPkId(prjCstId); ulFileQc.setTabNm("PRJ_CST_BSC_INFO");
		 * List<SysUlFilesRecVO> fileList =
		 * sysUlFilesRecService.searchList(ulFileQc);
		 */
		if (CollectionUtils.isNotEmpty(dtlList)) {
			for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : dtlList) {
				SysUlFilesRecQueryCondition ulFileQc = new SysUlFilesRecQueryCondition();
				ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
				ulFileQc.setSysCd(qc.getSysCd());
				ulFileQc.setOrgCd(orgCd);
				ulFileQc.setPkId(prjCstId);
				ulFileQc.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
				ulFileQc.setTabNm("PRJ_CST_BSC_INFO");
				List<SysUlFilesRecVO> fileList = sysUlFilesRecService
						.searchList(ulFileQc);
				if (CollectionUtils.isNotEmpty(fileList)) {
					// sysUlDatCfgDtlVO.setFileRecList(fileList);
					for (SysUlFilesRecVO sysUlFilesRecVO : fileList) {
						sysUlFilesRecVO.setDatNm(sysUlDatCfgDtlVO.getDatNm());
						sysUlFilesRecVO.setSysCd(sysUlDatCfgDtlVO.getSysCd());
						sysUlFilesRecVO.setOrgCd(sysUlDatCfgDtlVO.getOrgCd());
						sysUlFilesRecVO.setCfgCd(sysUlDatCfgDtlVO.getCfgCd());
						sysUlFilesRecVO.setCfgDtlCd(sysUlDatCfgDtlVO
								.getCfgDtlCd());
						dtlFileList.add(sysUlFilesRecVO);
						/*
						 * if(sysUlDatCfgDtlVO.getCfgDtlCd().equals(sysUlFilesRecVO
						 * .getCfgDtlCd())&&sysUlDatCfgDtlVO.getCfgCd().equals(
						 * sysUlFilesRecVO.getCfgCd())){
						 * sysUlDatCfgDtlVO.setFileRec(sysUlFilesRecVO); break;
						 * }
						 */
					}
				} else {
					SysUlFilesRecVO filesRecVO = new SysUlFilesRecVO();
					filesRecVO.setDatNm(sysUlDatCfgDtlVO.getDatNm());
					filesRecVO.setSysCd(sysUlDatCfgDtlVO.getSysCd());
					filesRecVO.setOrgCd(sysUlDatCfgDtlVO.getOrgCd());
					filesRecVO.setCfgCd(sysUlDatCfgDtlVO.getCfgCd());
					filesRecVO.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
					dtlFileList.add(filesRecVO);
				}
			}
		}

		String serverPath = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_SERVER_PATH);// 服务地址
		String customerPah = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_COSTOMER_PATH);
		String headPic = PropertiesCacheUtils
				.getProperty(fl.constant.facade.framework.constant.UploadConstant.DEFAULT_NO_PIC);
		// 客户类型
		ModelAndView view = new ModelAndView(
				"project/prjcstinvestrptinfo/projectGuarSurveyPhotosList");
		view.addObject("prjId", prjId);
		view.addObject("detailFlag", detailFlag);
		view.addObject("dtlList", dtlFileList);
		view.addObject("defImg", serverPath + customerPah + headPic);
		view.addObject("prjCstId", prjCstId);
		view.addObject("detailFlag", detailFlag);
		view.addObject("cstTypCd", cstTypCd);// 产品分类
		return view;
	}

	/**
	 * 到资信页面
	 */
	@RequestMapping(value = "/toPrjInvestPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjInvestPage(HttpServletRequest request,
										HttpServletResponse response) {
		logger.info("加载toPrjInvestRptPage 页面.");
		String prjId = request.getParameter("prjId");// 项目ID
		String detailFlag = request.getParameter("detailFlag");// 项目ID
		String cstRlCd = request.getParameter("cstRlCd");// 客户关系
		ModelAndView view = new ModelAndView("project/prjbscinfo/prjInvestRpt");
		view.addObject("prjId", prjId);
		view.addObject("detailFlag", detailFlag);
		view.addObject("cstRlCd", cstRlCd);
		return view;
	}

	/**
	 * 到资信整体查看大页面
	 */
	@RequestMapping(value = "/toPrjDetailInvestRptPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjDetailInvestRptPage(HttpServletRequest request,
												 HttpServletResponse response) {
		logger.info("加载toPrjInvestRptPage 页面.");
		String prjId = request.getParameter("prjId");// 项目ID
		String cstRlCd = request.getParameter("cstRlCd");
		CstBscInfoVO cstBscInfoVO = null;
		String cstType = "";
		Long cstId = null;
		Integer age = null;
		// 自然人配偶
		CstNpSocialRlVO rlVo = null;
		if (StringUtils.isNotBlank(prjId)) {
			cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
					.valueOf(prjId));
			if (null != cstBscInfoVO) {
				cstType = cstBscInfoVO.getCstTypCd();
				cstId = cstBscInfoVO.getId();
			}
		}
		PrjCstProfitAnaVO profit = null;
		PrjCstInvestRptVO rpt = null;
		PrjCstRepayAbiVO abi = null;
		CstNpBscInfoVO npInfo = null;
		CstCorpBscInfoVO corpInfo = null;
		CstBscInfoVO bscInfo = null;
		PrjBscInfoVO prjBscInfoVO = null;
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		if (StringUtils.isNotBlank(prjId) && null != cstId) {
			prjBscInfoVO = this.prjBscInfoService.selectById(Long
					.valueOf(prjId));
			rpt = this.prjCstInvestRptService
					.getPrjCstInvestRptByPrjIdAndCstId(Long.valueOf(prjId),
							cstId, cstRlCd);// 通过项目和客户id查询客户调查报告
			profit = this.prjCstProfitAnaService
					.getPrjCstProfitAnaByPrjIdAndCstId(Long.valueOf(prjId),
							cstId);// 通过项目和客户id查询客户调查报告
			abi = this.prjCstRepayAbiService.getPrjCstRepayAbiByPrjIdAndCstId(
					Long.valueOf(prjId), cstId, cstRlCd);// 通过项目和客户id查询客户还款能力
			bscInfo = this.cstBscInfoService.selectDetailById(cstId);
			if (null != prjBscInfoVO) {
				orgCd = prjBscInfoVO.getBuOrgCd();
			}
			if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
				// 自然人
				npInfo = bscInfo.getCstNpBscInfoVO();
				if (null != npInfo.getBirthday()) {
					npInfo.setAge(DateUtils.getYear(new Date())
							- DateUtils.getYear(DateUtils.formatStringToDate(
							npInfo.getBirthday(), DateUtils.YYYY_MM_DD)));// 生日
				}
				// 自然人配偶
				rlVo = npInfo.getCstNpSocialRlVO();
				if (null != rlVo&&rlVo.getCertTypCd().equals(PrjCstBscInfoConstant.CERT_TYP_CD_ID_CARD)) {
					// 计算配偶年龄
					String idCard = rlVo.getCertNo();
					//只有大陆的身份证计算年龄，香港的不计算
					if(!(idCard.length()<6||idCard.length()<14)){
						String birthday = idCard.substring(6, 14);
						Date birthdate = DateUtils.formatStringToDate(birthday,
								DateUtils.YYYYMMDD);
						Calendar currentDay = Calendar.getInstance();
						currentDay.setTime(birthdate);
						int year = currentDay.get(Calendar.YEAR);
						// 获取年龄
						SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
								"yyyy");
						String currYear = simpleDateFormat.format(new Date());
						age = Integer.parseInt(currYear) - year;
					}
				}

			}
			if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
				// 法人
				corpInfo = bscInfo.getCstCorpBscInfoVO();// 法人基础信息
			}
		}
		// 查询合格证信息
		AudCreditInfoVO tk = null;
		AuditCreditInfoQueryCondition condition = new AuditCreditInfoQueryCondition();
		condition.setProjectId(Long.valueOf(prjId));
		AudCreditInfoListRequest listRequest = new AudCreditInfoListRequest(condition,
				CurrentThreadContext.getCurrentSysCd(),
				CurrentThreadContext.getCurrentOrgCd());
		ResponseData<List<AuditCreditInfoDTO>> responseData = auditCreditInfoService.searchList(listRequest);
		if (responseData != null && ResponseData.SUCCESS_CODE.equals(responseData.getCode()) && responseData.getData() != null) {
			List<AuditCreditInfoDTO> data = responseData.getData();
			if (CollectionUtils.isNotEmpty(data)) {
				AuditCreditInfoDTO dto = data.get(0);
				tk = new AudCreditInfoVO();
				BeanUtils.copyProperties(dto, tk);
				tk.setHouseCret(dto.getHouseCert());
				tk.setFareType(dto.getFareTypeCd());
				tk.setChargingType(dto.getChargingTypeCd());
				tk.setHandingMode(dto.getHandlingMode());
			}
		}

		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			rpt = new PrjCstInvestRptVO();
			rpt.setInvestor(prjBscInfoVO.getCstMgrNm());
			Pager page = new Pager();
			PrjBscInfoQueryCondition prjQc = new PrjBscInfoQueryCondition();
			List<Long> idList = new ArrayList<Long>();
			idList.add(Long.valueOf(prjId));
			prjQc.setIdList(idList);
			prjQc.setUsrId(prjBscInfoVO.getCrtUsrId());
			prjQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
			prjQc.setOrgCd(prjBscInfoVO.getCstMgrOrgCd());
			page.setCondition(prjQc);
			page.setCurrentPage(1);
			page.setEveryPage(Integer.MAX_VALUE);
			Pager pager = this.prjBscInfoService.searchListPage(page);
			List<PrjBscInfoVO> list = (List<PrjBscInfoVO>) pager
					.getResultList();
			PrjBscInfoVO bsc = null;
			if (CollectionUtils.isNotEmpty(list)) {
				bsc = list.get(0);
				if (bsc.getApplyDt() != null) {
					rpt.setRptDt(bsc.getApplyDt());
				}
			}
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			if (StringUtils.isNotBlank(prjId) && null != cstId) {
				rpt = this.prjCstInvestRptService
						.getPrjCstInvestRptByPrjIdAndCstId(Long.valueOf(prjId),
								cstId, cstRlCd);// 通过项目和客户id查询客户调查报告
			}
		}

		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		// 查承租人照片配置信息
		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_NP);
			qc.setCfgCdList(codeList);
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_LP);
			qc.setCfgCdList(codeList);
		}

		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		SysUlDatCfgVO cfg = null;
		if (CollectionUtils.isNotEmpty(list)) {
			cfg = list.get(0);
		}
		List<SysUlDatCfgDtlVO> dtlList = cfg.getSysUlDatCfgDtlVOList();
		List<SysUlFilesRecVO> dtlFileList = new ArrayList<SysUlFilesRecVO>();
		/*
		 * SysUlFilesRecQueryCondition ulFileQc = new
		 * SysUlFilesRecQueryCondition();
		 * ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
		 * ulFileQc.setSysCd(qc.getSysCd());
		 * ulFileQc.setOrgCd(PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG);
		 * ulFileQc.setPkId(prjId); ulFileQc.setTabNm("PRJ_BSC_INFO");
		 * List<SysUlFilesRecVO> fileList =
		 * sysUlFilesRecService.searchList(ulFileQc);
		 */
		if (CollectionUtils.isNotEmpty(dtlList)) {
			for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : dtlList) {
				SysUlFilesRecQueryCondition ulFileQc = new SysUlFilesRecQueryCondition();
				ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
				ulFileQc.setSysCd(qc.getSysCd());
				ulFileQc.setOrgCd(orgCd);
				ulFileQc.setPkId(prjId);
				ulFileQc.setTabNm("PRJ_BSC_INFO");
				ulFileQc.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
				List<SysUlFilesRecVO> fileList = sysUlFilesRecService
						.searchList(ulFileQc);
				if (CollectionUtils.isNotEmpty(fileList)) {
					// sysUlDatCfgDtlVO.setFileRecList(fileList);
					for (SysUlFilesRecVO sysUlFilesRecVO : fileList) {
						sysUlFilesRecVO.setDatNm(sysUlDatCfgDtlVO.getDatNm());
						sysUlFilesRecVO.setDatNm(sysUlDatCfgDtlVO.getDatNm());
						sysUlFilesRecVO.setCfgCd(sysUlDatCfgDtlVO.getCfgCd());
						sysUlFilesRecVO.setSysCd(CurrentThreadContext
								.getCurrentSysCd());
						sysUlFilesRecVO.setOrgCd(orgCd);
						sysUlFilesRecVO.setCfgDtlCd(sysUlDatCfgDtlVO
								.getCfgDtlCd());
						dtlFileList.add(sysUlFilesRecVO);
						/*
						 * if(sysUlDatCfgDtlVO.getCfgDtlCd().equals(sysUlFilesRecVO
						 * .getCfgDtlCd())&&sysUlDatCfgDtlVO.getCfgCd().equals(
						 * sysUlFilesRecVO.getCfgCd())){
						 * sysUlDatCfgDtlVO.setFileRec(sysUlFilesRecVO); break;
						 * }
						 */
					}
					//
				} else {
					SysUlFilesRecVO filesRecVO = new SysUlFilesRecVO();
					filesRecVO.setDatNm(sysUlDatCfgDtlVO.getDatNm());
					filesRecVO.setCfgCd(sysUlDatCfgDtlVO.getCfgCd());
					filesRecVO.setSysCd(CurrentThreadContext.getCurrentSysCd());
					filesRecVO.setOrgCd(orgCd);
					filesRecVO.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
					dtlFileList.add(filesRecVO);
				}
			}
		}

		// 查询担保人信息
		// 法人
		// 自然人
		PrjCstBscInfoQueryCondition cstQc = new PrjCstBscInfoQueryCondition();
		cstQc.setPrjId(Long.valueOf(prjId));
		cstQc.setCstRlTyp(PrjCstBscInfoConstant.CST_Rl_ATTR_GUARANTOR);
		List<PrjCstBscInfoVO> cstList = this.prjCstBscInfoService
				.searchList(cstQc);
		Map<String, List<SysUlFilesRecVO>> npMap = new HashMap<String, List<SysUlFilesRecVO>>();// 自然人
		Map<String, List<SysUlFilesRecVO>> lpMap = new HashMap<String, List<SysUlFilesRecVO>>();// 法人

		for (PrjCstBscInfoVO prjCstBscInfoVO : cstList) {

			SysUlDatCfgQueryCondition fileQc = new SysUlDatCfgQueryCondition();
			if (prjCstBscInfoVO.getCstTypCd().equals(
					CustomerConstant.CST_TYP_CD_NP)) {
				List<String> codeList = new ArrayList<String>();
				codeList.add(PrjBscInfoConstant.CODE_GUAR_SURVEY_PHOTO_NP);
				fileQc.setCfgCdList(codeList);
			}
			if (prjCstBscInfoVO.getCstTypCd().equals(
					CustomerConstant.CST_TYP_CD_CORP)) {
				List<String> codeList = new ArrayList<String>();
				codeList.add(PrjBscInfoConstant.CODE_GUAR_SURVEY_PHOTO_LP);
				fileQc.setCfgCdList(codeList);
			}
			fileQc.setOrgCd(orgCd);
			fileQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
			List<SysUlDatCfgVO> cfglist = sysUlDatCfgService.searchList(fileQc);
			SysUlDatCfgVO cfgVo = null;
			if (CollectionUtils.isNotEmpty(cfglist)) {
				cfgVo = cfglist.get(0);
			}
			List<SysUlDatCfgDtlVO> guarDtlList = cfgVo
					.getSysUlDatCfgDtlVOList();
			List<SysUlFilesRecVO> guarDtlFileList = new ArrayList<SysUlFilesRecVO>();
			/*
			 * SysUlFilesRecQueryCondition guarUlFileQc = new
			 * SysUlFilesRecQueryCondition();
			 * guarUlFileQc.setCfgCd(fileQc.getCfgCdList().get(0));
			 * guarUlFileQc.setSysCd(fileQc.getSysCd());
			 * guarUlFileQc.setOrgCd(PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG);
			 * guarUlFileQc.setPkId(prjCstBscInfoVO.getId().toString());
			 * guarUlFileQc.setTabNm("PRJ_CST_BSC_INFO"); List<SysUlFilesRecVO>
			 * guarFileList = sysUlFilesRecService.searchList(guarUlFileQc);
			 */
			if (CollectionUtils.isNotEmpty(guarDtlList)) {
				for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : guarDtlList) {
					SysUlFilesRecQueryCondition guarUlFileQc = new SysUlFilesRecQueryCondition();
					guarUlFileQc.setCfgCd(fileQc.getCfgCdList().get(0));
					guarUlFileQc.setSysCd(fileQc.getSysCd());
					guarUlFileQc.setOrgCd(orgCd);
					guarUlFileQc.setPkId(prjCstBscInfoVO.getId().toString());
					guarUlFileQc.setTabNm("PRJ_CST_BSC_INFO");
					guarUlFileQc.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
					List<SysUlFilesRecVO> guarFileList = sysUlFilesRecService
							.searchList(guarUlFileQc);
					if (CollectionUtils.isNotEmpty(guarFileList)) {
						for (SysUlFilesRecVO sysUlFilesRecVO : guarFileList) {
							sysUlFilesRecVO.setDatNm(sysUlDatCfgDtlVO
									.getDatNm());
							sysUlFilesRecVO.setCfgCd(sysUlDatCfgDtlVO
									.getCfgCd());
							sysUlFilesRecVO.setSysCd(fileQc.getSysCd());
							sysUlFilesRecVO.setOrgCd(orgCd);
							sysUlFilesRecVO.setCfgDtlCd(sysUlDatCfgDtlVO
									.getCfgDtlCd());
							guarDtlFileList.add(sysUlFilesRecVO);
							/*
							 * if(sysUlDatCfgDtlVO.getCfgDtlCd().equals(
							 * sysUlFilesRecVO
							 * .getCfgDtlCd())&&sysUlDatCfgDtlVO.getCfgCd
							 * ().equals(sysUlFilesRecVO.getCfgCd())){
							 * sysUlDatCfgDtlVO.setFileRec(sysUlFilesRecVO); }
							 */
						}
						// sysUlDatCfgDtlVO.setFileRecList(guarFileList);
					} else {
						SysUlFilesRecVO fileVo = new SysUlFilesRecVO();
						fileVo.setDatNm(sysUlDatCfgDtlVO.getDatNm());
						fileVo.setCfgCd(sysUlDatCfgDtlVO.getCfgCd());
						fileVo.setSysCd(fileQc.getSysCd());
						fileVo.setOrgCd(orgCd);
						fileVo.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
						guarDtlFileList.add(fileVo);
					}
				}
			}

			if (prjCstBscInfoVO.getCstTypCd().equals(
					CustomerConstant.CST_TYP_CD_NP)) {
				npMap.put(prjCstBscInfoVO.getCstNm(), guarDtlFileList);
			}
			if (prjCstBscInfoVO.getCstTypCd().equals(
					CustomerConstant.CST_TYP_CD_CORP)) {
				lpMap.put(prjCstBscInfoVO.getCstNm(), guarDtlFileList);
			}

		}

		String serverPath = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_SERVER_PATH);// 服务地址
		String customerPah = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_COSTOMER_PATH);
		String headPic = PropertiesCacheUtils
				.getProperty(fl.constant.facade.framework.constant.UploadConstant.DEFAULT_NO_PIC);
		ModelAndView view = new ModelAndView(
				"project/prjcstinvestrptinfo/prjCstInvestRptInfoDetail");
		if ("101".equals(request.getParameter("pianflag"))) {
			//融资外部机构专用
			view = new ModelAndView("project/prjcstinvestrptinfo/prjCstInvestRptInfoDetail_W");
			view.addObject("pianflag",request.getParameter("pianflag"));
		}
		view.addObject("prjId", prjId);
		view.addObject("cstType", cstType);
		view.addObject("cstId", cstId);
		view.addObject("profit", profit);
		view.addObject("rpt", rpt);
		view.addObject("abi", abi);
		view.addObject("npInfo", npInfo);
		view.addObject("corpInfo", corpInfo);
		view.addObject("bscInfo", bscInfo);
		view.addObject("cstRlCd", cstRlCd);
		view.addObject("dtlList", dtlFileList);
		view.addObject("tk", tk);
		view.addObject("defImg", serverPath + customerPah + headPic);
		view.addObject("prjCstInvestRpt", rpt);
		view.addObject("npMap", npMap);
		view.addObject("lpMap", lpMap);
		view.addObject("age", age);
		view.addObject("rlVo", rlVo);
		return view;
	}

	/**
	 * 到资信整体大页面
	 */
	@RequestMapping(value = "/toPrjInvestRptPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjInvestRptPage(HttpServletRequest request,
										   HttpServletResponse response) {
		logger.info("加载toPrjInvestRptPage 页面.");
		String prjId = request.getParameter("prjId");// 项目ID
		String cstRlCd = request.getParameter("cstRlCd");
		CstBscInfoVO cstBscInfoVO = null;
		String cstType = "";
		Long cstId = null;
		if (StringUtils.isNotBlank(prjId)) {
			cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
					.valueOf(prjId));
			if (null != cstBscInfoVO) {
				cstType = cstBscInfoVO.getCstTypCd();
				cstId = cstBscInfoVO.getId();
			}
		}
		PrjCstProfitAnaVO profit = null;
		PrjCstInvestRptVO rpt = null;
		PrjCstRepayAbiVO abi = null;
		CstNpBscInfoVO npInfo = null;
		CstCorpBscInfoVO corpInfo = null;
		CstBscInfoVO bscInfo = null;
		int age = 0;
		// 自然人配偶
		CstNpSocialRlVO rlVo = null;
		if (StringUtils.isNotBlank(prjId) && null != cstId) {
			rpt = this.prjCstInvestRptService
					.getPrjCstInvestRptByPrjIdAndCstId(Long.valueOf(prjId),
							cstId, cstRlCd);// 通过项目和客户id查询客户调查报告
			profit = this.prjCstProfitAnaService
					.getPrjCstProfitAnaByPrjIdAndCstId(Long.valueOf(prjId),
							cstId);// 通过项目和客户id查询客户调查报告
			abi = this.prjCstRepayAbiService.getPrjCstRepayAbiByPrjIdAndCstId(
					Long.valueOf(prjId), cstId, cstRlCd);// 通过项目和客户id查询客户还款能力
			bscInfo = this.cstBscInfoService.selectDetailById(cstId);
			if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
				// 自然人
				npInfo = bscInfo.getCstNpBscInfoVO();
				if (null != npInfo.getBirthday()) {
					npInfo.setAge(DateUtils.getYear(new Date())
							- DateUtils.getYear(DateUtils.formatStringToDate(
							npInfo.getBirthday(), DateUtils.YYYY_MM_DD)));// 生日
				}
				// 自然人配偶
				rlVo = npInfo.getCstNpSocialRlVO();
				// 计算配偶年龄
				String idCard = rlVo.getCertNo();
				String birthday = idCard.substring(6, 14);
				Date birthdate = DateUtils.formatStringToDate(birthday,
						DateUtils.YYMMDD);
				Calendar currentDay = Calendar.getInstance();
				currentDay.setTime(birthdate);
				int year = currentDay.get(Calendar.YEAR);
				// 获取年龄
				SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy");
				String currYear = simpleDateFormat.format(new Date());
				age = Integer.parseInt(currYear) - year;
			}
			if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
				// 法人
				corpInfo = bscInfo.getCstCorpBscInfoVO();// 法人基础信息
			}
		}
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/prjCstInvestRptInfoDetail");
		view.addObject("prjId", prjId);
		view.addObject("cstType", cstType);
		view.addObject("cstId", cstId);
		view.addObject("profit", profit);
		view.addObject("rpt", rpt);
		view.addObject("abi", abi);
		view.addObject("npInfo", npInfo);
		view.addObject("corpInfo", corpInfo);
		view.addObject("bscInfo", bscInfo);
		view.addObject("cstRlCd", cstRlCd);
		view.addObject("rlVo", rlVo);
		view.addObject("age", age);
		return view;
	}

	/**
	 * 到担保人资信整体大页面
	 */
	@RequestMapping(value = "/toPrjGuarInvestRptPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjGuarInvestRptPage(HttpServletRequest request,
											   HttpServletResponse response) {
		logger.info("加载toPrjGuarInvestRptPage 页面.");
		String prjId = request.getParameter("prjId");// 项目ID
		String cstRlCd = request.getParameter("cstRlCd");
		String prjCstId = request.getParameter("prjCstId");// 项目客户ID
		String cstType = request.getParameter("cstTypCd");// 客户分类
		String cstId = request.getParameter("cstId");
		PrjCstProfitAnaVO profit = null;
		PrjCstInvestRptVO rpt = null;
		PrjCstRepayAbiVO abi = null;
		CstNpBscInfoVO npInfo = null;
		CstCorpBscInfoVO corpInfo = null;
		CstBscInfoVO bscInfo = null;
		if (StringUtils.isNotBlank(prjId) && null != cstId) {
			rpt = this.prjCstInvestRptService
					.getPrjCstInvestRptByPrjIdAndCstId(Long.valueOf(prjId),
							Long.valueOf(cstId), cstRlCd);// 通过项目和客户id查询客户调查报告
			profit = this.prjCstProfitAnaService
					.getPrjCstProfitAnaByPrjIdAndCstId(Long.valueOf(prjId),
							Long.valueOf(cstId));// 通过项目和客户id查询客户调查报告
			abi = this.prjCstRepayAbiService.getPrjCstRepayAbiByPrjIdAndCstId(
					Long.valueOf(prjId), Long.valueOf(cstId), cstRlCd);// 通过项目和客户id查询客户还款能力
			bscInfo = this.cstBscInfoService.selectDetailById(Long
					.valueOf(cstId));
			if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
				// 自然人
				npInfo = bscInfo.getCstNpBscInfoVO();
				if (null != npInfo.getBirthday()) {
					npInfo.setAge(DateUtils.getYear(new Date())
							- DateUtils.getYear(DateUtils.formatStringToDate(
							npInfo.getBirthday(), DateUtils.YYYY_MM_DD)));// 生日
				}

			}
			if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
				// 法人
				corpInfo = bscInfo.getCstCorpBscInfoVO();// 法人基础信息
			}
		}
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/prjGuarInvestRptList");
		view.addObject("prjId", prjId);
		view.addObject("cstType", cstType);
		view.addObject("cstId", cstId);
		view.addObject("profit", profit);
		view.addObject("rpt", rpt);
		view.addObject("abi", abi);
		view.addObject("npInfo", npInfo);
		view.addObject("corpInfo", corpInfo);
		view.addObject("bscInfo", bscInfo);
		view.addObject("cstRlCd", cstRlCd);
		view.addObject("cstId", cstId);
		view.addObject("prjCstId", prjCstId);
		return view;
	}

	/**
	 * 到担保人资信整体查看大页面
	 */
	@RequestMapping(value = "/toPrjGuarDetailInvestRptPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjGuarDetailInvestRptPage(
			HttpServletRequest request, HttpServletResponse response) {
		logger.info("加载toPrjGuarInvestRptPage 页面.");
		String prjId = request.getParameter("prjId");// 项目ID
		String cstRlCd = request.getParameter("cstRlCd");
		String prjCstId = request.getParameter("prjCstId");// 项目客户ID
		String cstType = request.getParameter("cstTypCd");// 客户分类
		String cstId = request.getParameter("cstId");
		PrjCstProfitAnaVO profit = null;
		PrjCstInvestRptVO rpt = null;
		PrjCstRepayAbiVO abi = null;
		CstNpBscInfoVO npInfo = null;
		CstCorpBscInfoVO corpInfo = null;
		CstBscInfoVO bscInfo = null;
		if (StringUtils.isNotBlank(prjId) && null != cstId) {
			rpt = this.prjCstInvestRptService
					.getPrjCstInvestRptByPrjIdAndCstId(Long.valueOf(prjId),
							Long.valueOf(cstId), cstRlCd);// 通过项目和客户id查询客户调查报告
			profit = this.prjCstProfitAnaService
					.getPrjCstProfitAnaByPrjIdAndCstId(Long.valueOf(prjId),
							Long.valueOf(cstId));// 通过项目和客户id查询客户调查报告
			abi = this.prjCstRepayAbiService.getPrjCstRepayAbiByPrjIdAndCstId(
					Long.valueOf(prjId), Long.valueOf(cstId), cstRlCd);// 通过项目和客户id查询客户还款能力
			bscInfo = this.cstBscInfoService.selectDetailById(Long
					.valueOf(cstId));
			if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
				// 自然人
				npInfo = bscInfo.getCstNpBscInfoVO();
				if (null != npInfo.getBirthday()) {
					npInfo.setAge(DateUtils.getYear(new Date())
							- DateUtils.getYear(DateUtils.formatStringToDate(
							npInfo.getBirthday(), DateUtils.YYYY_MM_DD)));// 生日
				}

			}
			if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
				// 法人
				corpInfo = bscInfo.getCstCorpBscInfoVO();// 法人基础信息
			}
		}
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/prjGuarDetailInvestRptList");
		view.addObject("prjId", prjId);
		view.addObject("cstType", cstType);
		view.addObject("cstId", cstId);
		view.addObject("profit", profit);
		view.addObject("rpt", rpt);
		view.addObject("abi", abi);
		view.addObject("npInfo", npInfo);
		view.addObject("corpInfo", corpInfo);
		view.addObject("bscInfo", bscInfo);
		view.addObject("cstRlCd", cstRlCd);
		view.addObject("cstId", cstId);
		view.addObject("prjCstId", prjCstId);
		return view;
	}

	/**
	 * 下载资信调查图片信息
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/downLoad.do", method = { RequestMethod.GET })
	@ResponseBody
	public void downLoad(HttpServletRequest request,
						 HttpServletResponse response) {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				SysLogConstant.LOG_CMM_DELETE_SUCC);
		String fileId = request.getParameter("fileId");// 文件ID
		String rootPath = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_ROOT_PATH);
		String serverPath = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_SERVER_PATH);
		try {
			if (StringUtils.isNotBlank(fileId)) {
				SysUlFilesRecVO file = this.sysUlFilesRecService
						.selectById(Long.valueOf(fileId));
				if (null != file) {
					ServletOutputStream out = null;
					InputStream iss = null;
					String fileName = file.getFileNm();
					response.setCharacterEncoding("UTF-8");
					response.setDateHeader("Expires", 0);

					response.setHeader("Cache-Control",
							"no-store, no-cache, must-revalidate");

					response.addHeader("Cache-Control",
							"post-check=0, pre-check=0");

					response.setHeader("Pragma", "no-cache");

					if (request.getHeader("User-Agent").toUpperCase()
							.indexOf("MSIE") > 0) {
						fileName = URLEncoder.encode(fileName, "UTF-8");
					} else {
						fileName = new String(fileName.getBytes("gb2312"),
								"ISO8859-1");
					}
					response.setHeader("Content-Disposition",
							"attachment; filename=" + fileName);
					out = response.getOutputStream();
					// 读取要下载的文件，保存到文件输入流
					String filePath = file.getFilePath();
					if (StringUtils.isNotEmpty(filePath)) {
						filePath = filePath.replace(serverPath, "");
						filePath = rootPath + filePath;
					}
					File outFile = new File(filePath);
					InputStream in = null;
					in = new FileInputStream(outFile);
					/*
					 * URL url = new URL(filePath); URLConnection conn =
					 * url.openConnection(); conn.setConnectTimeout(3*1000); iss
					 * = conn.getInputStream();
					 */

					// 创建输出流
					// 创建缓冲区
					byte buffer[] = new byte[1024];
					int len = 0;
					// 循环将输入流中的内容读取到缓冲区当中
					while ((len = in.read(buffer)) > 0) {
						// 输出缓冲区的内容到浏览器，实现文件下载
						out.write(buffer, 0, len);
					}
					// 关闭文件输入流
					in.close();
					// 关闭输出流
					out.close();
				}
			}
			logger.info("downLoad", "导出资信调查图片.[prjId=" + fileId
					+ "],操作人:{}", CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("downLoad,导出资信调查图片失败.prjId:{},msg:{},操作人:{}",fileId, ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			logger.error("导出资信调查图片失败,prjId:{},msg:{},操作人:{}",fileId,ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		}
		result.setSuccess(BaseConstant.IS_YESNO_YES);
	}

	/**
	 * 导出资信信息
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/exportInvesstRpt.do", method = { RequestMethod.GET })
	@ResponseBody
	public void exportInvesstRpt(HttpServletRequest request,
								 HttpServletResponse response) {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				SysLogConstant.LOG_CMM_DELETE_SUCC);
		String cstId = request.getParameter("cstId");// 客户ID
		String prjId = request.getParameter("prjId");// 项目ID
		String cstRlCd = request.getParameter("cstRlCd");// 客户关系
		try {
			if (StringUtils.isNotBlank(prjId)) {
				Document document = new Document();
				ByteArrayOutputStream out = new ByteArrayOutputStream();
				String pdfName = "承租人调查报告";
				String strFileName = pdfName + ".pdf";
				response.setContentType("application/pdf");
				response.setCharacterEncoding("UTF-8");
				response.setHeader("Pragma", "public");
				response.setHeader("Cache-Control",
						"must-revalidate, post-check=0, pre-check=0");
				response.setDateHeader("Expires", 0);
				if (request.getHeader("User-Agent").toUpperCase()
						.indexOf("MSIE") > 0) {
					strFileName = URLEncoder.encode(strFileName, "UTF-8");
				} else {
					strFileName = new String(strFileName.getBytes("gb2312"),
							"ISO8859-1");
				}
				response.setHeader("Content-Disposition",
						"attachment; filename=" + strFileName);
				/*
				 * response.setHeader("Content-Disposition",
				 * "attachment; filename=" + new
				 * String(pdfName.getBytes("UTF-8"), "ISO-8859-1"));
				 */
				ServletOutputStream o = response.getOutputStream();
				this.prjBscInfoService.exportInvesstRpt(Long.valueOf(prjId),
						Long.valueOf(cstId), cstRlCd, out);
				out.writeTo(o);
				o.flush();
				o.close();
			}
			logger.info("exportInvesstRpt,导出资信数据.prjId:{},操作人:{}",prjId, CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("exportInvesstRpt,导出资信数据失败.prjId:{},msg:{}",prjId ,ex.getMessage(),
					CurrentThreadContext.getCurrentUserName());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			logger.error("exportInvesstRpt,导出资信数据失败.prjId:{},msg:{}",prjId,ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		}
		result.setSuccess(BaseConstant.IS_YESNO_YES);
	}

	/**
	 * 导出担保人资信信息
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/exportGuarInvesstRpt.do", method = { RequestMethod.GET })
	@ResponseBody
	public void exportGuarInvesstRpt(HttpServletRequest request,
									 HttpServletResponse response) {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				SysLogConstant.LOG_CMM_DELETE_SUCC);
		String cstId = request.getParameter("cstId");// 客户ID
		String prjId = request.getParameter("prjId");// 项目ID
		String prjCstId = request.getParameter("prjCstId");// 客户ID
		String cstRlCd = request.getParameter("cstRlCd");// 客户关系（客户、担保人、紧急联系人）
		try {
			if (StringUtils.isNotBlank(prjId)
					&& StringUtils.isNotBlank(prjCstId)) {
				Document document = new Document();
				ByteArrayOutputStream out = new ByteArrayOutputStream();
				String pdfName = "担保人调查报告";
				String strFileName = pdfName + ".pdf";
				response.setContentType("application/pdf");
				response.setCharacterEncoding("UTF-8");
				response.setHeader("Pragma", "public");
				response.setHeader("Cache-Control",
						"must-revalidate, post-check=0, pre-check=0");
				response.setDateHeader("Expires", 0);
				if (request.getHeader("User-Agent").toUpperCase()
						.indexOf("MSIE") > 0) {
					strFileName = URLEncoder.encode(strFileName, "UTF-8");
				} else {
					strFileName = new String(strFileName.getBytes("gb2312"),
							"ISO8859-1");
				}
				response.setHeader("Content-Disposition",
						"attachment; filename=" + strFileName);
				ServletOutputStream o = response.getOutputStream();
				this.prjBscInfoService.exportGuarInvesstRpt(
						Long.valueOf(prjId), Long.valueOf(cstId),
						Long.valueOf(prjCstId), cstRlCd, out);
				out.writeTo(o);
				o.flush();
				o.close();
			}
			logger.info("exportInvesstRpt，导出资信数据.prjId:{},操作人:{}",prjId, CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("exportInvesstRpt,导出资信数据失败.prjId:{},msg:{},操作人:{}",prjId,ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			logger.error("exportInvesstRpt,导出资信数据失败.prjId:{},msg:{},操作人:{}",prjId,ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		}
		result.setSuccess(BaseConstant.IS_YESNO_YES);
	}

	/**
	 * 联系人
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initPrjLinkManList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initPrjLinkManList(HttpServletRequest request,
									 HttpServletResponse response) {
		String cstId = request.getParameter("cstId");
		String prjId = request.getParameter("prjId");
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		PrjLinkManQueryCondition qc = new PrjLinkManQueryCondition();
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		/*
		 * if(StringUtils.isNotBlank(cstId)){ qc.setCstId(Long.valueOf(cstId));
		 * }
		 */
		if (StringUtils.isNotBlank(prjId)) {
			qc.setPrjId(Long.valueOf(prjId));
		}
		page.setCondition(qc);
		Pager pager = this.prjLinkManService.searchListPage(page);
		List<PrjLinkManVO> list = (List<PrjLinkManVO>) pager.getResultList();
		ListPageVO<PrjLinkManVO> listPage = new ListPageVO<PrjLinkManVO>(list,
				pager.getTotalCount());
		return listPage;
	}

	/**
	 * 融资信息
	 */
	/*
	 * @SuppressWarnings("unchecked")
	 *
	 * @RequestMapping(value = "/initPrjPrdInfo.do", method = {
	 * RequestMethod.GET})
	 *
	 * @ResponseBody public Object initPrjPrdInfo(HttpServletRequest request,
	 * HttpServletResponse response) { String prjId =
	 * request.getParameter("prjId"); //查询商品信息 PrjPrdBscInfoQueryCondition qc =
	 * new PrjPrdBscInfoQueryCondition(); if(StringUtils.isNotBlank(prjId)){
	 * qc.setPrjId(Long.valueOf(prjId)); }
	 *
	 * List<PrjPrdBscInfoVO> list = this.prjPrdBscInfoService.searchList(qc);
	 * ListPageVO<PrjPrdBscInfoVO> listPage = new
	 * ListPageVO<PrjPrdBscInfoVO>(list,list.size()); return listPage; }
	 */

	/**
	 * 关联公司/合作机构
	 */
	/*
	 * @SuppressWarnings("unchecked")
	 *
	 * @RequestMapping(value = "/initCstCorpRlCompList.do", method = {
	 * RequestMethod.GET})
	 *
	 * @ResponseBody public Object initCstCorpRlCompList(HttpServletRequest
	 * request, HttpServletResponse response) { String cstId =
	 * request.getParameter("cstId"); Pager page = new Pager();
	 * CstCorpRlCompQueryCondition qc = new CstCorpRlCompQueryCondition();
	 * if(StringUtils.isNotBlank(cstId)){ List<Long> ids = new
	 * ArrayList<Long>(); ids.add(Long.valueOf(cstId)); qc.setCstIdList(ids); }
	 * page.setCondition(qc); List<CstCorpRlCompVO> list =
	 * this.cstCorpRlCompService.searchList(qc); ListPageVO<CstCorpRlCompVO>
	 * listPage = new ListPageVO<CstCorpRlCompVO>(list,list.size()); return
	 * listPage; }
	 */
	/**
	 * 法人企业历史
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initCstCorpHisList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initCstCorpHisList(HttpServletRequest request,
									 HttpServletResponse response) {
		String cstId = request.getParameter("cstId");
		/*
		 * String currentPage = request.getParameter("page"); String pageSize =
		 * request.getParameter("pagesize"); Pager page = new Pager(); if
		 * (StringUtils.isNotEmpty(currentPage)) {
		 * page.setCurrentPage(Integer.parseInt(currentPage)); }
		 *
		 * if (StringUtils.isNotEmpty(currentPage)) {
		 * page.setEveryPage(Integer.parseInt(pageSize)); }
		 */
		CstCorpHisQueryCondition qc = new CstCorpHisQueryCondition();
		qc.setCstId(Long.valueOf(cstId));
		List<CstCorpHisVO> list = this.cstCorpHisService.searchList(qc);
		ListPageVO<CstCorpHisVO> listPage = new ListPageVO<CstCorpHisVO>(list,
				0);
		return listPage;
	}

	/**
	 * 法人企业团队简历信息表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initCstCorpTeamResumeList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initCstCorpTeamResumeList(HttpServletRequest request,
											HttpServletResponse response) {
		String cstId = request.getParameter("cstId");
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		Pager page = new Pager();
		CstCorpTeamResumeQueryCondition qc = new CstCorpTeamResumeQueryCondition();
		CstCorpTeamQueryCondition teamQc = new CstCorpTeamQueryCondition();
		if (StringUtils.isNotBlank(cstId)) {
			teamQc.setCstId(Long.valueOf(cstId));
		}
		teamQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		List<CstCorpTeamVO> teamList = this.cstCorpTeamService
				.searchList(teamQc);
		Map<Long, CstCorpTeamVO> teamMap = new HashMap<Long, CstCorpTeamVO>();
		List<Long> ids = new ArrayList<Long>();
		if (CollectionUtils.isNotEmpty(teamList)) {
			for (CstCorpTeamVO cstCorpTeamVO : teamList) {
				ids.add(cstCorpTeamVO.getId());
				teamMap.put(cstCorpTeamVO.getId(), cstCorpTeamVO);
			}
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}

		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		page.setCondition(qc);
		qc.setMemIdList(ids);
		Pager pager = this.cstCorpTeamResumeService.searchListPage(page);
		List<CstCorpTeamResumeVO> list = (List<CstCorpTeamResumeVO>) pager
				.getResultList();
		if (CollectionUtils.isNotEmpty(list)) {
			for (CstCorpTeamResumeVO cstCorpTeamResumeVO : list) {
				if (teamMap.containsKey(cstCorpTeamResumeVO.getMemId())) {
					cstCorpTeamResumeVO.setCstCorpTeamVO(teamMap
							.get(cstCorpTeamResumeVO.getMemId()));
				}
			}
		}
		ListPageVO<CstCorpTeamResumeVO> listPage = new ListPageVO<CstCorpTeamResumeVO>(
				list, pager.getTotalCount());
		return listPage;
	}

	/**
	 * 法人企业团队信息表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initCstCorpTeamList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initCstCorpTeamList(HttpServletRequest request,
									  HttpServletResponse response) {
		String cstId = request.getParameter("cstId");
		Pager page = new Pager();
		CstCorpTeamQueryCondition qc = new CstCorpTeamQueryCondition();
		if (StringUtils.isNotBlank(cstId)) {
			if (StringUtils.isNotBlank(cstId)) {
				List<Long> ids = new ArrayList<Long>();
				ids.add(Long.valueOf(cstId));
				qc.setCstIdList(ids);
			}
		}
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		page.setCondition(qc);
		List<CstCorpTeamVO> list = this.cstCorpTeamService.searchList(qc);
		List<CstCorpTeamVO> teamList = new ArrayList<CstCorpTeamVO>();
		if (CollectionUtils.isNotEmpty(list)) {
			for (CstCorpTeamVO cstCorpTeamVO : list) {
				if (cstCorpTeamVO.getMTypCd().equals(
						PrjCstBscInfoConstant.CST_CORP_TEAM_REPR)
						|| cstCorpTeamVO.getMTypCd().equals(
						PrjCstBscInfoConstant.CST_CORP_TEAM_MGR)
						|| cstCorpTeamVO.getMTypCd().equals(
						PrjCstBscInfoConstant.CST_CORP_TEAM_FINA)) {
					teamList.add(cstCorpTeamVO);
				}
			}
		}
		ListPageVO<CstCorpTeamVO> listPage = new ListPageVO<CstCorpTeamVO>(
				teamList, list.size());
		return listPage;
	}

	/**
	 * 法人股东信息表
	 */
	/*
	 * @SuppressWarnings("unchecked")
	 *
	 * @RequestMapping(value = "/initCorpShrList.do", method = {
	 * RequestMethod.GET})
	 *
	 * @ResponseBody public Object initCorpShrList(HttpServletRequest request,
	 * HttpServletResponse response) { String cstId =
	 * request.getParameter("cstId"); Pager page = new Pager();
	 * CstCorpShrQueryCondition qc = new CstCorpShrQueryCondition();
	 * if(StringUtils.isNotBlank(cstId)){ List<Long> ids = new
	 * ArrayList<Long>(); ids.add(Long.valueOf(cstId)); qc.setCstIdList(ids); }
	 * page.setCondition(qc); List<CstCorpShrVO> list =
	 * this.cstCorpShrService.searchList(qc); ListPageVO<CstCorpShrVO> listPage
	 * = new ListPageVO<CstCorpShrVO>(list,list.size()); return listPage; }
	 */
	/**
	 * 自然人社会关系信息表
	 */
	/*
	 * @SuppressWarnings("unchecked")
	 *
	 * @RequestMapping(value = "/initCstNpSocialRlList.do", method = {
	 * RequestMethod.GET})
	 *
	 * @ResponseBody public Object initCstNpSocialRlList(HttpServletRequest
	 * request, HttpServletResponse response) { String cstId =
	 * request.getParameter("cstId"); Pager page = new Pager();
	 * CstNpSocialRlQueryCondition qc = new CstNpSocialRlQueryCondition();
	 * if(StringUtils.isNotBlank(cstId)){ List<Long> ids = new
	 * ArrayList<Long>(); ids.add(Long.valueOf(cstId)); qc.setCstIdList(ids); }
	 * page.setCondition(qc); List<CstNpSocialRlVO> list =
	 * CstNpSocialRlVOTransform
	 * .toVOList(this.cstNpSocialRlService.searchList(qc));
	 * ListPageVO<CstNpSocialRlVO> listPage = new
	 * ListPageVO<CstNpSocialRlVO>(list,list.size()); return listPage; }
	 */
	@RequestMapping(value = "/getSplDetailById.do", method = { RequestMethod.GET })
	public ModelAndView getSplDetailById(HttpServletRequest request,
										 HttpServletResponse response) {
		logger.info("加载getSplDetailById列表页面.");
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/prdSplDetail");
		String id = request.getParameter("id");
		// 查询供应商信息
		SplInfoVO vo = prdSplInfoService.selectById(Long.valueOf(id));
		SplRlPsnQueryCondition qc = new SplRlPsnQueryCondition();
		qc.setSplId(Long.valueOf(id));
		SplRlPsnVO splPsn = null;
		List<SplRlPsnVO> splRlPsnList = prdSplRlPsnService.searchList(qc);
		if (CollectionUtils.isNotEmpty(splRlPsnList)
				&& splRlPsnList.size() != 0) {
			splPsn = splRlPsnList.get(0);
		}
		view.addObject("spl", vo);
		view.addObject("splPsn", splPsn);
		return view;
	}

	/**
	 * 到添加页面
	 */
	@RequestMapping(value = "/toAddPage.do", method = { RequestMethod.GET,RequestMethod.POST })
	public ModelAndView toAddPage(HttpServletRequest request,HttpServletResponse response) {
		logger.info("加载PrjBscInfo add页面.");
		String fromPrjFlag = request.getParameter("fromPrjFlag");
		String cstId = request.getParameter("cstId");
		String cstNm = request.getParameter("cstNm");
		String showTabs = request.getParameter("showTabs");
		// 查询当前登录人是不是客户经理
		Long currRoleId = CurrentThreadContext.getCurrentRoleId();// 当前登录角色ID
		boolean flag = this.prjBscInfoService
				.getCurrentUserRoleStatus(currRoleId);// 判断当前用户是不是客户经理
		Long cstMgrId = null;
		List<SysUsrVO> actMgrList = null;
		if (flag) {
			cstMgrId = CurrentThreadContext.getCurrentUserId();
			actMgrList = new ArrayList<SysUsrVO>();
			SysUsrVO usrVo = this.sysUsrService.selectById(cstMgrId,
					CurrentThreadContext.getCurrentSysCd());
			if (null != usrVo) {
				usrVo.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
			}
			actMgrList.add(usrVo);//获取到的当前系统的用户
		} else {
			actMgrList = this.prjBscInfoService
					.getCstMgrListByOrgId(CurrentThreadContext
							.getCurrentOrgCd());
		}
		// 事业部
		List<String> orgCds = new ArrayList<>();
		orgCds.add(CurrentThreadContext.getCurrentBuOrgCd());
		orgCds.add(CurrentThreadContext.getCurrentOrgCd());

		/*
		 * //数据来源 List<KeyValueVO> dsList = this.prjBscInfoService.getDsList();
		 */
		// 根据当前用户的组织机构查询客户经理列表
		/*
		 * List<SysUsrVO> actMgrList =
		 * this.prjBscInfoService.getCstMgrListByOrgId
		 * (CurrentThreadContext.getCurrentOrgCd()); String orgTextName =
		 * this.prjBscInfoService
		 * .getOrgTextName(CurrentThreadContext.getCurrentOrgId());
		 *
		 * /* // 业务种类 List<KeyValueVO> loanTypCdList =
		 * this.prjBscInfoService.getLoanTypCdList();
		 */
		List<KeyValueVO> bizTypCdList = this.prjBscInfoService
				.getBizTypCdList();// 业务模式
		List<KeyValueVO> cntTypCdList = this.prjBscInfoService
				.getCntTypCdList();// 合同签署方式
		List<KeyValueVO> yesNoList = this.prjBscInfoService.getYesNoList();
		//是否需要抵押(tsn)
		List<KeyValueVO> kvList = this.sysDictionaryApiService.getKvList(PrjBscInfoConstant.CODE_PLEDJE, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
		//主货物大类
		List<KeyValueVO> mainGdsTypCdList = this.audCreditInfoService.searchGoodsTypListByLvl("1");
		//货物来源
		List<KeyValueVO> goodsResList = this.audReturnVisitService.searchGoodsResList();
		//代偿担保业务类型
		List<KeyValueVO> compensatoryTypeList = this.prjBscInfoService.getCompensatoryTypeList();
		//大客户业务来源
		List<KeyValueVO> bigCstWorkSourceList = this.prjBscInfoService.getBigCstWorkSourceList();
		// 是否从项目新增
		ModelAndView view = new ModelAndView("project/prjbscinfo/projectPrjBscInfoAdd");
		view.addObject("compensatoryTypeList", compensatoryTypeList);
		view.addObject("bigCstWorkSourceList", bigCstWorkSourceList);
		view.addObject("orgCds", orgCds);
		/* view.addObject("dsList", dsList); */
		view.addObject("fromPrjFlag", fromPrjFlag);
		view.addObject("showTabs", showTabs);
		view.addObject("cstId", cstId);//客户ID
		view.addObject("cstMgrId", cstMgrId);//客户经理ID
		view.addObject("cstNm", cstNm);//客户名称
		view.addObject("bizTypCdList", bizTypCdList);//业务模式
		view.addObject("actMgrList", actMgrList);//系统用户
		view.addObject("mgrFlag", flag);
		view.addObject("cntTypCdList", cntTypCdList);// 合同签署方式
		view.addObject("yesNoList",yesNoList);

		// view.addObject("orgTextName", orgTextName);
		view.addObject("currOrgId", CurrentThreadContext.getCurrentOrgId());
		/* view.addObject("loanTypCdList", loanTypCdList); */
		view.addObject("currOrg", CurrentThreadContext.getCurrentOrgCd());
		view.addObject("buOrgCd", CurrentThreadContext.getCurrentBuOrgCd());
		view.addObject("kvList", kvList);//是否需要抵押 （tsn）
		view.addObject("mainGdsTypCdList", mainGdsTypCdList);//主货物大类
		view.addObject("goodsResList", goodsResList);//主运输货物

		//业务线字典List
		List<KeyValueVO> bussinessLineDicList = sysDictionaryApiService.getKvList("REF0048","11000","0000");
		//机构信息List
		List<FriBaseInfoVO> friBaseInfoVOList = this.friBaseInfoService.searchList(new FriBaseInfoQueryCondition());
		//根据金融机构业务线,设置金融机构名称展示字段值
		FundRasInsNmChangeUtil.insNmShowAddBussinessLineDic(friBaseInfoVOList,bussinessLineDicList);

		/**
		 * 二手车机构配置
		 */
		/**
		List<SysDictionaryDTO> sysDictionaryDTOS = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentBuOrgCd(), cn.fl.framework.constant.DictionaryConstant.CODE_ESC_INS_CF);
		logger.info("toAddPage,获取二手车机构配置sysDictionaryDTOS:{},操作人：{}",JSON.toJSONString(sysDictionaryDTOS), CurrentThreadContext.getCurrentUserName());
		JSONArray escConfigArray = new JSONArray();
		if(CollectionUtils.isNotEmpty(sysDictionaryDTOS)){
			Map<String,List<JSONObject>> resMap = new HashMap<String,List<JSONObject>>();
			for (SysDictionaryDTO sysDictionaryDTO : sysDictionaryDTOS) {
				if(resMap.containsKey(sysDictionaryDTO.getCodeNm())){
					JSONObject obj = new JSONObject();
					obj.put("insId",sysDictionaryDTO.getCodeAttr1());
                    String insNmShow = FundRasInsNmChangeUtil.getFundRasInsNmShow(friBaseInfoVOList,sysDictionaryDTO.getCodeAttr1());
                    obj.put("insNmShow",StringUtils.isEmpty(insNmShow) ? sysDictionaryDTO.getCodeAttr2() : insNmShow);
                    obj.put("insNm",sysDictionaryDTO.getCodeAttr2());
					obj.put("insCode",sysDictionaryDTO.getCodeDesc());
					List<JSONObject> jsonObjects = resMap.get(sysDictionaryDTO.getCodeNm());
					jsonObjects.add(obj);
					resMap.put(sysDictionaryDTO.getCodeNm(), jsonObjects);
				}else{
					List<JSONObject> obList = new ArrayList<JSONObject>();
					JSONObject obj = new JSONObject();
					obj.put("insId",sysDictionaryDTO.getCodeAttr1());
					String insNmShow = FundRasInsNmChangeUtil.getFundRasInsNmShow(friBaseInfoVOList,sysDictionaryDTO.getCodeAttr1());
					obj.put("insNmShow",StringUtils.isEmpty(insNmShow) ? sysDictionaryDTO.getCodeAttr2() : insNmShow);
					obj.put("insNm",sysDictionaryDTO.getCodeAttr2());
					obj.put("insCode",sysDictionaryDTO.getCodeDesc());
					obList.add(obj);
					resMap.put(sysDictionaryDTO.getCodeNm(),obList);
				}
			}
			if(MapUtils.isNotEmpty(resMap)){
				for (Map.Entry<String, List<JSONObject>> entry : resMap.entrySet()){
					JSONObject escConfig = new JSONObject();
					escConfig.put("buOrgCd",CurrentThreadContext.getCurrentBuOrgCd());
					escConfig.put("prjTypCd",entry.getKey());
					escConfig.put("insList",entry.getValue());
					escConfigArray.add(escConfig);
				}
			}
		}
		logger.info("toAddPage,获取二手车机构配置escConfigArray:{},操作人:{}",JSON.toJSONString(escConfigArray), CurrentThreadContext.getCurrentUserName());
		view.addObject("insListCfg", escConfigArray);
		*/
		//查询银行列表
		List<KeyValueVO> bankList = this.prjBscInfoService.searchCdList(PrjCstAccInfoConstant.CODE_CZB_SUPPORT_BANK_CD);
		view.addObject("bankList",JSON.toJSONString(bankList));
		//当前事业部下支持预筛选的项目类型list
        JSONArray prjTypCdAllowedList = new JSONArray();
        //预筛选强校验关联项目类型
		JSONArray prjTypCdAllowedMap = new JSONArray();
		//预筛选路由配置list
		List<SysDictionaryDTO> preRouteConfList = this.sysDictionaryApiService.searchGroupAll(CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(),"PRJ0254");
		logger.info("加载PrjBscInfo add页面,preRouteConfList:{}", JSON.toJSONString(preRouteConfList));
        if(CollectionUtils.isNotEmpty(preRouteConfList)){
            for (SysDictionaryDTO sysDictionaryDTO: preRouteConfList){
				JSONObject prjTypCdAllowedInfo = new JSONObject();
				prjTypCdAllowedInfo.put("prjTypCd",sysDictionaryDTO.getCode());
				prjTypCdAllowedInfo.put("preStrCheckFlag",sysDictionaryDTO.getCodeAttr1());
				prjTypCdAllowedMap.add(prjTypCdAllowedInfo);
                prjTypCdAllowedList.add(sysDictionaryDTO.getCode());
            }
        }

		logger.info("加载PrjBscInfo add页面,prjTypCdAllowedList:{},prjTypCdAllowedMap:{}",JSON.toJSONString(prjTypCdAllowedList),JSON.toJSONString(prjTypCdAllowedMap));
		view.addObject("prjTypCdAllowedList",prjTypCdAllowedList);
        view.addObject("prjTypCdAllowedMap",prjTypCdAllowedMap);

        //预筛选规则强校验flag
        /**
		SysCtrlCfgQueryCondition qc = new SysCtrlCfgQueryCondition();
        qc.setSysCd(WebBaseConstant.SYS_SYS_CD);
        qc.setOrgCd(WebBaseConstant.SYS_P_ORG_CD);
        qc.setCtrlCode("PRE_ROUTE_0002");
        logger.info("加载PrjBscInfo add页面,预筛选规则强校验 params:{}",JSON.toJSONString(qc));
        String preStrCheckFlag = this.sysCtrlCfgApiService.searchSysCtrlCfgByCtrlCode(qc);
        logger.info("加载PrjBscInfo add页面,预筛选规则强校验 result:{}",preStrCheckFlag);
        view.addObject("preStrCheckFlag",preStrCheckFlag);
		 */
		//未发起流程标志
		view.addObject("flowCheckStsCd", "1");
        return view;
	}

	@RequestMapping(value = "/judgeThreshold.do", method = { RequestMethod.POST })
	@ResponseBody()
	public String judgeThreshold(HttpServletRequest request,
								 HttpServletResponse response){
		String prjId = request.getParameter("prjId");
		String flag = this.prjBscInfoService.searchSysCtrlCfgByCtrlCode();
		String result = "success";
		if(!StringUtils.isEmpty(flag)&&flag!=null){
			if(flag.equals("1")){
				PrjPrdBscInfoQueryCondition qc = new PrjPrdBscInfoQueryCondition();
				qc.setPrjId(Long.valueOf(prjId));
				List<PrjPrdBscInfoVO> list = prjPrdBscInfoService.searchList(qc);
				if(list.size()>0){
					result = "failed";
				}
			}
		}
		return result;
	}

	/**
	 * 到项目产品列表页面(运维专用)
	 */
	@RequestMapping(value = "/toPrjPrdListPage4Sys.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjPrdListPage4Sys(HttpServletRequest request,
											 HttpServletResponse response) {
		logger.info("到项目产品列表页面.");
		String prjId = request.getParameter("id");
		String detailFlag = request.getParameter("detailFlag");
		String changeFlag = request.getParameter("changeFlag");
		String isFlow = request.getParameter("isFlow");
		PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
		String prjTypCd =(null==prjBscInfoVO.getPrjTypCd()?"":prjBscInfoVO.getPrjTypCd());
		String insCode  =(null==prjBscInfoVO.getInsCode()||PrjBscInfoConstant.PRJ_INS_CODE_SQ.equals(prjBscInfoVO.getInsCode())?"":prjBscInfoVO.getInsCode());
		ModelAndView view = new ModelAndView(
				"project/prjprdbscinfo/projectPrjPrdBscInfoList4Sys");
		view.addObject("prjId", prjId);
		view.addObject("detailFlag", detailFlag);
		view.addObject("changeFlag", changeFlag);

		//********流程参数开始********//
		String preTaskIds = request.getParameter("preTaskIds");//流程上一个节点任务ID,多个以逗号分割.
		String pInstId = request.getParameter("pInstId");//流程实例ID
		view.addObject("pInstId", pInstId);
		view.addObject("preTaskIds", preTaskIds);
		view.addObject("isFlow", isFlow);
		view.addObject("prjTypCd", prjTypCd);
		view.addObject("insCode", insCode);
		//********流程参数结束********//

		return view;
	}

	/**
	 * 到项目产品列表页面
	 */
	@RequestMapping(value = "/toPrjPrdListPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjPrdListPage(HttpServletRequest request,
										 HttpServletResponse response) {
		logger.info("到项目产品列表页面.");
		String prjId = request.getParameter("id");
		String detailFlag = request.getParameter("detailFlag");
		String changeFlag = request.getParameter("changeFlag");
		String isFlow = request.getParameter("isFlow");
		PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
		String prjTypCd =(null==prjBscInfoVO.getPrjTypCd()?"":prjBscInfoVO.getPrjTypCd());
		String insCode  =(null==prjBscInfoVO.getInsCode()?"":prjBscInfoVO.getInsCode());
		String buOrgCd  =(null==prjBscInfoVO.getBuOrgCd()?"":prjBscInfoVO.getBuOrgCd());
		ModelAndView view = new ModelAndView(
				"project/prjprdbscinfo/projectPrjPrdBscInfoList");
		view.addObject("prjId", prjId);
		view.addObject("compensatoryType", prjBscInfoVO.getCompensatoryType());
		view.addObject("dsCd",prjBscInfoVO.getDsCd()) ;
		view.addObject("detailFlag", detailFlag);
		view.addObject("changeFlag", changeFlag);

		//********流程参数开始********//
		String preTaskIds = request.getParameter("preTaskIds");//流程上一个节点任务ID,多个以逗号分割.
		String pInstId = request.getParameter("pInstId");//流程实例ID
		view.addObject("pInstId", pInstId);
		view.addObject("preTaskIds", preTaskIds);
		view.addObject("isFlow", isFlow);
		view.addObject("prjTypCd", prjTypCd);
		view.addObject("insCode", insCode);
		view.addObject("buOrgCd", buOrgCd);
		//********流程参数结束********//
		//融资外部机构专用
		view.addObject("pianflag",request.getParameter("pianflag"));
		return view;
	}

	/**
	 * 到搜索产品信息页面
	 */
	@RequestMapping(value = "/toPrjPrdPage.do", method = { RequestMethod.GET,
			RequestMethod.POST })
	public ModelAndView toPrjPrdPage(HttpServletRequest request,
									 HttpServletResponse response) {
		logger.info("加载PrjBscInfo add页面.");
		String prjId = request.getParameter("id");
		// TODO 2017-2-24 YAOXIURONG List<KeyValueVO> brandList =
		// this.prdBscInfoService.searchBrandList();
		List<KeyValueVO> audStsList = this.prdBscInfoService
				.searchAudStsCdList();
		List<KeyValueVO> brCdSelectList = this.prdBscInfoService
				.searchBrCdListByUser();
		JSONArray mfrKvlJson = this.prjBscInfoService.getMfrKvlist("");
		ModelAndView view = new ModelAndView(
				"project/prjprdbscinfo/projectPrjPrdList");
		view.addObject("prjId", prjId);
		view.addObject("audStsList", audStsList);
		view.addObject("brCdSelectList", brCdSelectList);
		// TODO 2017-2-24 YAOXIURONG view.addObject("brandList", brandList);
		view.addObject("mfrKvlJson", mfrKvlJson);
		return view;
	}

	/**
	 * 根据品牌获取车系
	 */
	@RequestMapping(value = "/getCarTypSelectList.do", method = { RequestMethod.POST })
	@ResponseBody
	public HashMap<String, Object> getCarTypSelectList(
			HttpServletRequest request, HttpServletResponse response) {

		HashMap<String, Object> result = new HashMap<String, Object>();
		String brCdId = request.getParameter("brCdId");

		List<PrdBscInfoVO> carTypSelect = this.prdBscInfoService
				.searchcarTypSelectByCon(brCdId);
		List<String> temp = new ArrayList<String>();
		if (!CollectionUtils.isEmpty(carTypSelect)) {
			for (PrdBscInfoVO prdBscInfoVO : carTypSelect) {
				temp.add(prdBscInfoVO.getPrdMdl());
			}
		}

		result.put("result", temp);
		return result;
	}

	/**
	 *
	 * 检查客户否有必填信息没有填写
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/checkCstRequiredField.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object checkCstRequiredField(HttpServletRequest request,
										HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");
		String cstId = request.getParameter("cstId");
		try {
			if (StringUtils.isBlank(cstId)) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
			} else {
				boolean flag = this.prjBscInfoService
						.checkCstRequiredField(Long.valueOf(cstId));
				if (flag) {
					result.setSuccess(BaseConstant.IS_YESNO_YES);
				} else {
					result.setSuccess(BaseConstant.IS_YESNO_NO);
				}
			}
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		}
		return result;
	}

	/**
	 * 其他租赁物用途
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/searchPrjIndTree.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object searchPrjIndTree(HttpServletRequest request,
								   HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");

		try {
			JSONArray array = new JSONArray();
			array = this.prjBscInfoService.searchPrjIndTree();
			if (null == array) {
				array = new JSONArray();
			}
			result.setData(array);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		}
		return result;
	}

	/**
	 * 组织机构信息
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/searchOrgTree.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object searchOrgTree(HttpServletRequest request,
								HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");
		String cstMgrOrgCd = request.getParameter("cstMgrOrgCd");// 客户经理ID
		try {
			JSONArray array = new JSONArray();
			Long currentOrgId = CurrentThreadContext.getCurrentOrgId();
			array = this.prjBscInfoService.searchParentAndCurrentAllsOrgTree(
					currentOrgId, cstMgrOrgCd);
			// array =
			// this.sysOrgService.searchOrgTreeByCurrentUser(CurrentThreadContext.getCurrentOrgCd(),
			// CurrentThreadContext.getCurrentSysCd());
			if (null == array) {
				array = new JSONArray();
			}
			result.setData(array);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		}
		return result;
	}

	/**
	 * 组织机构信息
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/searchBuOrgTree.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object searchBuOrgTree(HttpServletRequest request,
								  HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");
		String cstMgrOrgCd = request.getParameter("cstMgrOrgCd");// 客户经理ID
		String userId = request.getParameter("userId");
		try {
			JSONArray array = new JSONArray();
			array = this.prjBscInfoService.searchBuParentAndCurrentAllsOrgTree(cstMgrOrgCd,userId);
			if (null == array) {
				array = new JSONArray();
			}
			result.setData(array);
            logger.info("searchBuOrgTree,客户经理组织机构:cstMgrOrgCd:{},用户id:{},组织机构列表{},操作人:{}",cstMgrOrgCd,userId,JSONObject.toJSONString(array),CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		}
		return result;
	}

	/**
	 * 根据模式查找形式
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/selectByBizTyp.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object selectByBizTyp(HttpServletRequest request,
								 HttpServletResponse response) throws BaseException {
		Map<String,Object> result = new HashMap<String,Object>();
		String bizTypCd = request.getParameter("bizTypCd");// 业务模式
		List<KeyValueVO> brCdSelectList = this.prdBscInfoService
				.searchbizModCdListByUser(bizTypCd);
		result.put("brCdSelectList", brCdSelectList);
		return result;
	}

	/**
	 * 根据模式查找类型
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/selectByBizTypTemp.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object selectByBizTypTemp(HttpServletRequest request,
									 HttpServletResponse response) throws BaseException {
		Map<String,Object> result = new HashMap<String,Object>();
		String bizTypCd = request.getParameter("bizTypCd");// 业务模式
		List<KeyValueVO> selectList = this.prdBscInfoService.searchprjTypCdListByUser(bizTypCd);
		result.put("selectList", selectList);
		return result;
	}

	/**
	 * 根据产品分类和明细ID查询商品明细
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getDataByPrdTypeAndDetailId.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object getDataByPrdTypeAndDetailId(HttpServletRequest request,
											  HttpServletResponse response) throws BaseException {
		String prdDetailId = request.getParameter("prdDetailId");
		String prdCd = request.getParameter("prdCd");
		String prdTypCd = request.getParameter("prdTypCd");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");
		if (StringUtils.isEmpty(prdDetailId)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("参数不完整！");
			return result;
		}

		try {
			String prdType = "";
			if (StringUtils.isNotBlank(prdTypCd)) {
				prdType = prdTypCd.substring(0, ProductConstant.PRD_TYE_LENGHT);
				prdCd = prdTypCd;
			}

			// 查询商品信息
			PrdBscInfoVO prdBscInfo = this.prjBscInfoService
					.getPrdBscAndPrdDetailInfo(prdCd, prdDetailId);
			if (null == prdBscInfo) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("数据不存在！");
			}
			result.setData(prdBscInfo);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		}
		return result;
	}


	/**
	 * 检查项目名称是否存在
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/checkPrjNm.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object checkPrjNm(HttpServletRequest request,
							 HttpServletResponse response) throws BaseException {
		String prjNm = request.getParameter("prjNm");// 项目名称是否相同
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");
		if (StringUtils.isEmpty(prjNm)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("参数不完整！");
			return result;
		}

		try {
			// 查询项目名称是否存在
			List<PrjBscInfoVO> list = this.prjBscInfoService
					.getPrjBscInfoByPrjNm(prjNm);
			if (CollectionUtils.isEmpty(list)) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("数据不存在！");
			}
			result.setData(list);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		}
		return result;
	}

	/**
	 * 到产品详细信息页面
	 */
	@RequestMapping(value = "/toPrjPrdDetailPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjPrdDetailPage(HttpServletRequest request,
										   HttpServletResponse response) {
		logger.info("加载PrjBscInfo add页面.");
		String prdDetailId = request.getParameter("id");//产品明细ID180510070000365
		String prdCd = request.getParameter("prdCd");
		String bizTypCd = request.getParameter("bizTypCd");
		String bizCd = request.getParameter("bizCd");
		String sGrpCd = request.getParameter("sGrpCd");
		String sCode = request.getParameter("sCode");
		String prdTypCdNm = request.getParameter("prdTypCdNm");
		String prjId = request.getParameter("prjId");//
		String prdDtlId = request.getParameter("id");// 产品明细ID 
		String prdTypCd = request.getParameter("prdTypCd");

		// 产品计量单位类型
		List<KeyValueVO> prdUntCdList = this.prjBscInfoService.getPrdUntList();
		// 品牌类别
		List<KeyValueVO> brTypCdList = this.prjBscInfoService.getBrTypCdList();
		// 产品种类
		List<KeyValueVO> prdClsCdList = this.prjBscInfoService
				.getPrdClsCdList();
		// 保险购买方式
		List<KeyValueVO> buyWayCdList = this.prjBscInfoService
				.getBuyWayCdList();
		List<KeyValueVO> yesNoCdList = this.prjQuatPrpsCfgMService
				.searchYesOrNoCdList();
		// 根据产品分类查询产品信息
		String prdType = "";
		if (StringUtils.isNotBlank(prdTypCd)) {
			prdType = prdTypCd.substring(0, ProductConstant.PRD_TYE_LENGHT);
			/*
			 * if(!(prdType.equals(ProductConstant.PRD_BUS_CD)||prdType.equals(
			 * ProductConstant.PRD_CAR_CD))){ prdCd = prdType; }
			 */
		}
		PrjBscInfoVO bscVo = this.prjBscInfoService.selectById(Long.valueOf(prjId));

		//前置征信客户ID
		RcCstBscInfoDTO rcCstBscInfo = null;
		Boolean isCheck = false;
		if(StringUtils.isNotEmpty(bscVo.getRcCstBscInfoId())){
			isCheck = true;
			//获取原来的供货商
			rcCstBscInfo = riskCtrlSearchApiService.getRcCstBscInfoById(bscVo.getRcCstBscInfoId());
		}
		Long accId = null;//供应商账号id
		String accNo = "";//供应商账号
		Long backAccId = null;//供应商返利id
		String backAccNo="";// 供应商账号
		Integer hasSplBackNo = BaseConstant.IS_YESNO_NO;
		boolean tkFlag = false;
		if (!(prdType.equals(ProductConstant.PRD_BUS_CD) || prdType
				.equals(ProductConstant.PRD_CAR_CD))) {
			tkFlag = true;// 卡车查询挂靠公司信息
		}
		SysCdMapDVO map = this.prjPrdBscInfoService.searchBizCodeByPrdCd(prdType);
		SysCdMapDVO plcyMap = this.prjPrdBscInfoService.searchPlcyMapByPrdCd(prdCd);
		List<KeyValueVO> licenseCdList = this.prjBscInfoService.getLicenseCdList();

		ModelAndView view = new ModelAndView(
				"project/prjprdbscinfo/projectPrdInfoAdd");
		view.addObject("isCheck", isCheck);//是否默认供应商
		if(rcCstBscInfo != null){
			view.addObject("splId", rcCstBscInfo.getSplId());
			view.addObject("splNm", rcCstBscInfo.getSplNm());
		}
		view.addObject("prdDetailId", prdDetailId);
		view.addObject("prdUntCdList", prdUntCdList);
		view.addObject("prdCd", prdCd);
		view.addObject("plcyTcode", null==plcyMap?"":plcyMap.getTCode());
		view.addObject("bizTypCd", map.getTGrpCd());
		view.addObject("yesNoCdList", yesNoCdList);
		view.addObject("bizCd", map.getTCode());
		view.addObject("bizCdFir", (map.getTCode()).substring(0, 3));
		view.addObject("sGrpCd", map.getSGrpCd());
		view.addObject("sCode", map.getSCode());
		view.addObject("bizCd", bizCd);
		view.addObject("prdTypCdNm", prdTypCdNm);
		view.addObject("tkFlag", tkFlag);
		view.addObject("prjId", prjId);
		view.addObject("prdDtlId", prdDtlId);
		view.addObject("brTypCdList", brTypCdList);
		view.addObject("prdClsCdList", prdClsCdList);
		view.addObject("buyWayCdList", buyWayCdList);
		view.addObject("buOrgCd", bscVo.getBuOrgCd());
		view.addObject("prjTypCd", bscVo.getPrjTypCd());
		view.addObject("isSplMfr", bscVo.getIsSplMfr());
		view.addObject("insCode", bscVo.getInsCode());
		view.addObject("accId", accId);
		view.addObject("accNo", accNo);
		view.addObject("backAccId", backAccId);
		view.addObject("backAccNo", backAccNo);
		view.addObject("hasSplBackNo", hasSplBackNo);
		view.addObject("licenseCdList", licenseCdList);
		view.addObject("prdTypCd", prdTypCd);
		return view;
	}

	/**
	 * 到产品详细信息页面
	 */
	@RequestMapping(value = "/prdBscInfoDynamicPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView prdBscInfoDynamicPage(HttpServletRequest request,
											  HttpServletResponse response) {
		logger.info("加载PrjBscInfo add页面.");
		String prdId = request.getParameter("id");
		String prdCd = request.getParameter("prdCd");
		String bizTypCd = request.getParameter("bizTypCd");
		String bizCd = request.getParameter("bizCd");
		String sGrpCd = request.getParameter("sGrpCd");
		String sCode = request.getParameter("sCode");
		String prdTypCdNm = request.getParameter("prdTypCdNm");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectPrdBscInfoAddDynamicPage");
		view.addObject("prdId", prdId);
		view.addObject("prdCd", prdCd);
		view.addObject("bizTypCd", bizTypCd);
		view.addObject("bizCd", bizCd);
		view.addObject("sGrpCd", sGrpCd);
		view.addObject("sCode", sCode);
		view.addObject("prdTypCdNm", prdTypCdNm);
		return view;
	}

	/**
	 * 到产品详细信息页面
	 */
	@RequestMapping(value = "/prdDetailInfoDynamicPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView prdDetailInfoDynamicPage(HttpServletRequest request,
												 HttpServletResponse response) {
		logger.info("加载动态产品详细信息页面.");
		String prdId = request.getParameter("id");
		String prdCd = request.getParameter("prdCd");
		String bizTypCd = request.getParameter("bizTypCd");
		String bizCd = request.getParameter("bizCd");
		String sGrpCd = request.getParameter("sGrpCd");
		String sCode = request.getParameter("sCode");
		String prdTypCdNm = request.getParameter("prdTypCdNm");

		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectPrdDetailDynamicPage");
		view.addObject("prdId", prdId);
		view.addObject("prdCd", prdCd);
		view.addObject("bizTypCd", bizTypCd);
		view.addObject("bizCd", bizCd);
		view.addObject("sGrpCd", sGrpCd);
		view.addObject("sCode", sCode);
		view.addObject("prdTypCdNm", prdTypCdNm);
		return view;
	}

	/**
	 *
	 * 获取厂商信息
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getMfrKvlist.do", method = { RequestMethod.GET })
	@ResponseBody
	public JSONArray getMfrKvlist(HttpServletRequest request,
								  HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");
		JSONArray mfrKvlJson = null;
		try {
			String name = request.getParameter("name");
			// 产品厂商
			mfrKvlJson = this.prjBscInfoService.getMfrKvlist(name);
			result.setData(mfrKvlJson);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		}
		return mfrKvlJson;
	}

	/**
	 *
	 * 获取产品分类树
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getPrdTyeData.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object getPrdTyeData(HttpServletRequest request,
								HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");
		try {
			// 产品分类树
			JSONArray jsonArray = this.prjBscInfoService.searchPrdTyeList();
			result.setData(jsonArray);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		}
		return result;
	}

	/**
	 * 获取车身颜色
	 */
	@RequestMapping(value = "/getCarClList.do", method = { RequestMethod.GET })
	@ResponseBody
	public List<KeyValueVO> getCarClList() {
		return prjQuatPrpsCfgMService.searchCarClList();
	}

	/**
	 * 到修改页面
	 */
	@RequestMapping(value = "/toModifyPage.do", method = { RequestMethod.GET,RequestMethod.POST })
	public ModelAndView toModifyPage(HttpServletRequest request, HttpServletResponse response) {
		try {
			String id = request.getParameter("id");
			String showTabs = request.getParameter("showTabs");
			logger.info("加载PrjBscInfo Modify页面.");
			String fromPrjFlag = request.getParameter("fromPrjFlag");
			String cstId = request.getParameter("cstId");
			String cstNm = request.getParameter("cstNm");
			String isFlow = request.getParameter("isFlow");
			String detailFlag = request.getParameter("detailFlag");
			String ywParam = request.getParameter("ywParam");
			String buOrgCd = request.getParameter("buOrgCd");
            // 信审初审节点flag
			String fromCAFlag = request.getParameter("fromCAFlag");
            // 客户经理修改flag
            String fromCMFlag = request.getParameter("fromCMFlag");
			//********流程参数开始********//
			String preTaskIds = request.getParameter("preTaskIds");//流程上一个节点任务ID,多个以逗号分割.
			String processInstanceId = request.getParameter("processInstanceId");//流程实例ID
			//********流程参数结束********//
			if(StringUtils.isEmpty(id)){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"项目ID不能为空");
			}
            PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long.valueOf(id));
			/**
			 * 如果特批流程审核中  detailFlag置为true
			 */
			Integer isAllowNonIns = prjBsc.getIsAllowNonIns();
			boolean dfg = isAllowNonIns != null && IsAllowNonInsBizEnum.APPROVAL.code.equals(isAllowNonIns);
			if(dfg){
				detailFlag = "true";
				fromCAFlag = "false";
				fromCMFlag = "false";
			}
			// 查询当前登录人是不是客户经理
			Long currRoleId = CurrentThreadContext.getCurrentRoleId();// 当前登录角色ID
			boolean flag = this.prjBscInfoService.getCurrentUserRoleStatus(currRoleId);// 判断当前用户是不是客户经理
			Long cstMgrId = null;
			List<SysUsrVO> actMgrList = null;
			if (flag) {
				if(StringUtils.isNotBlank(prjBsc.getCstMgrOrgCd())){
					//PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long.valueOf(id));
					actMgrList = this.prjBscInfoService.getCstMgrListByOrgId(prjBsc.getCstMgrOrgCd());
				}else{
					cstMgrId = CurrentThreadContext.getCurrentUserId();
					actMgrList = new ArrayList<SysUsrVO>();
					SysUsrVO usrVo = this.sysUsrService.selectById(cstMgrId,CurrentThreadContext.getCurrentSysCd());
					if (null != usrVo) {
						usrVo.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
					}
					actMgrList.add(usrVo);
				}
			} else {
				if(StringUtils.isNotBlank(id)){
					actMgrList = this.prjBscInfoService.getCstMgrListByOrgId(prjBsc.getCstMgrOrgCd());
				}else{
					actMgrList = this.prjBscInfoService.getCstMgrListByOrgId(CurrentThreadContext.getCurrentOrgCd());
				}
			}
			if (CollectionUtils.isEmpty(actMgrList) && StringUtils.isNotBlank(id)) {
				// 查询
				//PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long.valueOf(id));
				actMgrList = this.prjBscInfoService.getCstMgrListByOrgId(prjBsc.getCstMgrOrgCd());
			}
			// 事业部
			List<String> orgCds = new ArrayList<>();
			String cstMgrOrgCd = "";
			if (("true").equals(detailFlag)||StringUtils.isNotBlank(id)) {
				//PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long.valueOf(id));
				cstMgrOrgCd = prjBsc.getCstMgrOrgCd();

				orgCds.add(prjBsc.getBuOrgCd());
				orgCds.add(prjBsc.getCstMgrOrgCd());
			} else {
				orgCds.add(CurrentThreadContext.getCurrentBuOrgCd());
				orgCds.add(CurrentThreadContext.getCurrentOrgCd());
			}
			//PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long.valueOf(id));
			String bizModCd = prjBsc.getBizModCd();
			String prjTypCd = prjBsc.getPrjTypCd();
			String pledgeCd = prjBsc.getPledge();//抵押       (tsn)
			String mainGdsTypCd = prjBsc.getMainGdsTypCd();//主货物大类
			String goodsRes = prjBsc.getGoodsRes();//主运输货物
			List<KeyValueVO> bizTypCdList = new ArrayList<KeyValueVO>();
			if(("true").equals(detailFlag)||StringUtils.isNotBlank(id)){
				bizTypCdList = this.prjBscInfoService.getBizTypCdList();// 业务模式
			}else{
				bizTypCdList = this.prjBscInfoService.getBizTypCdDetailList();// 业务模式
			}
			if(StringUtils.isBlank(buOrgCd)){
				buOrgCd = prjBsc.getBuOrgCd();
			}
			List<KeyValueVO> cntTypCdList = this.prjBscInfoService.getCntTypCdList();// 合同签署方式
			List<KeyValueVO> yesNoList = this.prjBscInfoService.getYesNoList();
			//是否需要抵押(tsn)
			List<KeyValueVO> kvList = this.sysDictionaryApiService.getKvList(PrjBscInfoConstant.CODE_PLEDJE, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
			//主货物大类
			List<KeyValueVO> mainGdsTypCdList = this.audCreditInfoService.searchGoodsTypListByLvl("1");
			//货物来源
			List<KeyValueVO> goodsResList = this.audReturnVisitService.searchGoodsResList();
            //查询项目类型
            /*List<KeyValueVO> prjTypCdList = this.prjBscInfoService.getPrjTypCdALLKV();*/
			List<KeyValueVO> prjTypCdList = this.prjBscInfoService.getKeyValueList(DictionaryConstant.CODE_PRJ_TYPE_CD,CurrentThreadContext.getCurrentSysCd(),prjBsc.getCstMgrOrgCd());
			//代偿担保业务类型
			List<KeyValueVO> compensatoryTypeList = this.prjBscInfoService.getCompensatoryTypeList();
            //大客户业务来源
            List<KeyValueVO> bigCstWorkSourceList = this.prjBscInfoService.getBigCstWorkSourceList();
			// 是否从项目新增
			ModelAndView view = new ModelAndView("project/prjbscinfo/projectPrjBscInfoAdd");
            view.addObject("bigCstWorkSourceList", bigCstWorkSourceList);
			view.addObject("compensatoryTypeList", compensatoryTypeList);
			view.addObject("compensatoryType", prjBsc.getCompensatoryType() == null ? "0" : prjBsc.getCompensatoryType());
			view.addObject("isBigCstWork", prjBsc.getIsBigCstWork());
			view.addObject("dsCd", prjBsc.getDsCd());
			view.addObject("prjTypCdList", prjTypCdList);
			view.addObject("detailFlag", detailFlag);
			/* view.addObject("dsList", dsList); */
			view.addObject("bizModCd", bizModCd);
			view.addObject("prjTypCd", prjTypCd);
			view.addObject("showTabs", showTabs);
			view.addObject("fromPrjFlag", fromPrjFlag);
			view.addObject("cstMgrOrgCd", cstMgrOrgCd);
			view.addObject("cstId", cstId);
			view.addObject("cstNm", cstNm);
			view.addObject("ywParam", ywParam);
			view.addObject("buOrgCd", buOrgCd);
			view.addObject("id", id);
			view.addObject("detailFlag", detailFlag);
			view.addObject("orgCds", orgCds);
			view.addObject("cstMgrId", cstMgrId);
			view.addObject("bizTypCdList", bizTypCdList);
			view.addObject("cntTypCdList", cntTypCdList);// 合同签署方式
			view.addObject("actMgrList", actMgrList);
			view.addObject("mgrFlag", flag);
			view.addObject("currOrgId", CurrentThreadContext.getCurrentOrgId());
			view.addObject("currOrg", prjBsc.getCstMgrOrgCd());//客户经理组织结构
			view.addObject("isFlow", isFlow);
			view.addObject("cstId", prjBsc.getCstId());
			view.addObject("yesNoList",yesNoList);
			view.addObject("isSplMfr",prjBsc.getIsSplMfr());
            view.addObject("isInsBiz",prjBsc.getIsInsBiz());
            //新增支付表类型(支付表启用)
            view.addObject("paySchTypCd",prjBsc.getPaySchTypCd());
            // 信审初审节点flag
			view.addObject("fromCAFlag", fromCAFlag);

            view.addObject("fromCMFlag", fromCMFlag);
			String taskNm = request.getParameter("taskNm");
			if (StringUtils.isNotEmpty(taskNm) && "呈报人".equals(taskNm) && !dfg) view.addObject("fromCMFlag", true);

			//********流程参数开始********//
			view.addObject("preTaskIds", preTaskIds);
			view.addObject("pInstId", processInstanceId);
			view.addObject("kvList", kvList);// diya  (tsn)
			view.addObject("pledgeCd", pledgeCd);//diya   (tsn)
			view.addObject("mainGdsTypCdList", mainGdsTypCdList);
			view.addObject("goodsResList", goodsResList);
			view.addObject("mainGdsTypCd", mainGdsTypCd);
			view.addObject("goodsRes", goodsRes);
			//********流程参数结束********//
			/* view.addObject("loanTypCdList", loanTypCdList); */

            //优车：车抵贷业务(线下)、二手车交易贷
            if ((StringUtils.isNotBlank(prjBsc.getBuOrgCd())&& PrjBscInfoConstant.CODE_BU_ORG_CD_YC.equals(prjBsc.getBuOrgCd()))){
                if (StringUtils.isNotBlank(prjTypCd) && (PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjBsc.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjBsc.getPrjTypCd()) || PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjBsc.getPrjTypCd()))){
                    PrjBscExtDTO prjBscExtDTO = this.prjBscExtApiService.searchById(Long.valueOf(id));
                    logger.info("toModifyPage，项目id {},项目基础信息扩展表prjBscExtDTO:{} ",id ,JSON.toJSONString(prjBscExtDTO));
                    if (prjBscExtDTO!=null && prjBscExtDTO.getHomeVisit()!=null){
                        view.addObject("homeVisit", prjBscExtDTO.getHomeVisit());
                    }
                }
            }

            //车抵贷业务 查询车抵贷预约编号
			if(StringUtils.isNotBlank(prjBsc.getPrjTypCd())&&PrjBscInfoConstant.PRJ_TYP_CD_CDDYW.equals(prjBsc.getPrjTypCd())){
				OdrBscInfoVO odrBscInfoVO = this.odrBscInfoService.selectById(prjBsc.getId());
				if(null != odrBscInfoVO){
					view.addObject("odrNo", odrBscInfoVO.getOdrNo());//车抵贷预约编号
				}
			}

			if (PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjBsc.getPrjTypCd())
					|| PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjBsc.getPrjTypCd())
					|| PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjBsc.getPrjTypCd())) {
				//查询流程状态
				SysFlowSHQueryCondition queryCondition = new SysFlowSHQueryCondition();
				queryCondition.setSysCd(CurrentThreadContext.getCurrentSysCd());
				queryCondition.setDataId(prjBsc.getId());
				queryCondition.setWordsInTheTable(PrjBscInfoConstant.PRJ_FLOW_S_H_PRJ);
				queryCondition.setStatus(BaseConstant.IS_YESNO_YES);
				queryCondition.setBusTyp(FlowConstant.FLOW_MODEL_TYP_PRJ_1);
				logger.error("二手车查询流程记录Start.prjId:{},qc:{}", prjBsc.getId(), JSON.toJSONString(queryCondition));
				List<SysFlowSHDTO> flowSHDTOList = this.flowQueryApiService.searchFlowSHList(queryCondition);
				logger.error("二手车查询流程记录End.prjId:{},list:{}", prjBsc.getId(), JSON.toJSONString(flowSHDTOList));
				if (CollectionUtils.isNotEmpty(flowSHDTOList)) {
					SysFlowSHDTO sysFlowSHDTO = flowSHDTOList.get(0);
					//项目流程审核状态(SYS0019)
					view.addObject("audStsCd",sysFlowSHDTO.getAudStsCd());
					if (FlowConstant.FLOW_CHECK_STATE_PRE_IN.equals(sysFlowSHDTO.getAudStsCd())
							|| FlowConstant.FLOW_CHECK_STATE_PRE_REJECT.equals(sysFlowSHDTO.getAudStsCd())) {
						//呈报人(预审)、预审审核节点
						view.addObject("flowCheckStsCd", "1");
					} else if (FlowConstant.FLOW_CHECK_STATE_PRE_PASS.equals(sysFlowSHDTO.getAudStsCd())
							|| FlowConstant.FLOW_CHECK_STATE_REJECT.equals(sysFlowSHDTO.getAudStsCd())) {
						//呈报人（信审）
						view.addObject("flowCheckStsCd", "2");
					}
				} else {
					//未发起流程
					view.addObject("flowCheckStsCd", "1");
				}
			}

			//业务线字典List
			List<KeyValueVO> bussinessLineDicList = sysDictionaryApiService.getKvList("REF0048","11000","0000");
			//机构信息List
			List<FriBaseInfoVO> friBaseInfoVOList = this.friBaseInfoService.searchList(new FriBaseInfoQueryCondition());
			//根据金融机构业务线,设置金融机构名称展示字段值
			FundRasInsNmChangeUtil.insNmShowAddBussinessLineDic(friBaseInfoVOList,bussinessLineDicList);

			/** 二手车机构配置
			List<SysDictionaryDTO> sysDictionaryDTOList = this.sysDictionaryApiService.searchGroup(CurrentThreadContext.getCurrentSysCd(), prjBsc.getCstMgrOrgCd(), cn.fl.framework.constant.DictionaryConstant.CODE_ESC_INS_CF);
			logger.info("toAddPage,获取二手车机构配置sysDictionaryDTOS:{},操作人:{}",JSON.toJSONString(sysDictionaryDTOList), CurrentThreadContext.getCurrentUserName());
			JSONArray escConfigArray = new JSONArray();
			if(CollectionUtils.isNotEmpty(sysDictionaryDTOList)){
				Map<String,List<JSONObject>> resMap = new HashMap<String,List<JSONObject>>();
				for (SysDictionaryDTO sysDictionaryDTO : sysDictionaryDTOList) {
					if(resMap.containsKey(sysDictionaryDTO.getCodeNm())){
						JSONObject obj = new JSONObject();
						obj.put("insId",sysDictionaryDTO.getCodeAttr1());
						String insNmShow = FundRasInsNmChangeUtil.getFundRasInsNmShow(friBaseInfoVOList,sysDictionaryDTO.getCodeAttr1());
						obj.put("insNmShow",StringUtils.isEmpty(insNmShow) ? sysDictionaryDTO.getCodeAttr2() : insNmShow);
						obj.put("insNm",sysDictionaryDTO.getCodeAttr2());
						obj.put("insCode",sysDictionaryDTO.getCodeDesc());
						List<JSONObject> jsonObjects = resMap.get(sysDictionaryDTO.getCodeNm());
						jsonObjects.add(obj);
						resMap.put(sysDictionaryDTO.getCodeNm(), jsonObjects);
					}else{
						List<JSONObject> obList = new ArrayList<JSONObject>();
						JSONObject obj = new JSONObject();
						obj.put("insId",sysDictionaryDTO.getCodeAttr1());
                        String insNmShow = FundRasInsNmChangeUtil.getFundRasInsNmShow(friBaseInfoVOList,sysDictionaryDTO.getCodeAttr1());
                        obj.put("insNmShow",StringUtils.isEmpty(insNmShow) ? sysDictionaryDTO.getCodeAttr2() : insNmShow);
                        obj.put("insNm",sysDictionaryDTO.getCodeAttr2());
						obj.put("insCode",sysDictionaryDTO.getCodeDesc());
						obList.add(obj);
						resMap.put(sysDictionaryDTO.getCodeNm(),obList);
					}
				}
				if(MapUtils.isNotEmpty(resMap)){
					for (Map.Entry<String, List<JSONObject>> entry : resMap.entrySet()){
						JSONObject escConfig = new JSONObject();
						escConfig.put("buOrgCd",CurrentThreadContext.getCurrentBuOrgCd());
						escConfig.put("prjTypCd",entry.getKey());
						escConfig.put("insList",entry.getValue());
						escConfigArray.add(escConfig);
					}
				}
			}
			logger.info("toAddPage，获取二手车机构配置escConfigArray:{},操作人:{}",JSON.toJSONString(escConfigArray), CurrentThreadContext.getCurrentUserName());
			view.addObject("insListCfg", escConfigArray);
			*/
			//查询银行列表
			List<KeyValueVO> bankList = this.prjBscInfoService.searchCdList(PrjCstAccInfoConstant.CODE_CZB_SUPPORT_BANK_CD);
			view.addObject("bankList",JSON.toJSONString(bankList));
			//浙商特殊处理
			if(StringUtils.isNotBlank(prjBsc.getInsCode())&&PrjBscInfoConstant.PRJ_INS_CODE_ZS.equals(prjBsc.getInsCode())){
				if(null != prjBsc.getPrjCstAccInfoVO()){
					view.addObject("certNo", prjBsc.getPrjCstAccInfoVO().getCertNo());
					view.addObject("certTypCd", prjBsc.getPrjCstAccInfoVO().getCertTypCd());
					view.addObject("bkNm", prjBsc.getPrjCstAccInfoVO().getBkNm());
					view.addObject("bkNo", prjBsc.getPrjCstAccInfoVO().getBkNo());
					view.addObject("accNo", prjBsc.getPrjCstAccInfoVO().getAccNo());
					view.addObject("mp", prjBsc.getPrjCstAccInfoVO().getMp());
				}
				//自然人客户
				view.addObject("cstTypCd", CustomerConstant.CST_TYP_CD_NP);
				//浙商 暂不支持法人客户
				CstNpBscInfoVO cstNpBscInfoVO = this.cstNpBscInfoService.selectById(prjBsc.getCstId());
				if(null != cstNpBscInfoVO){
					view.addObject("certValidSDt", cstNpBscInfoVO.getCertValidSDt());
					view.addObject("certValidEDt", cstNpBscInfoVO.getCertValidEDt());
				}
			}
			//苏宁特殊处理
			if(StringUtils.isNotBlank(prjBsc.getInsCode())&&PrjBscInfoConstant.PRJ_INS_CODE_SN.equals(prjBsc.getInsCode())){
				if(null != prjBsc.getPrjCstAccInfoVO()){
					view.addObject("certNo", prjBsc.getPrjCstAccInfoVO().getCertNo());
					view.addObject("certTypCd", prjBsc.getPrjCstAccInfoVO().getCertTypCd());
					view.addObject("bkNm", prjBsc.getPrjCstAccInfoVO().getBkNm());
					view.addObject("bkNo", prjBsc.getPrjCstAccInfoVO().getBkNo());
					view.addObject("accNo", prjBsc.getPrjCstAccInfoVO().getAccNo());
					view.addObject("mp", prjBsc.getPrjCstAccInfoVO().getMp());
					view.addObject("insAccNo", prjBsc.getPrjCstAccInfoVO().getInsAccNo());
				}
				//自然人客户
				view.addObject("cstTypCd", CustomerConstant.CST_TYP_CD_NP);
				//浙商 暂不支持法人客户
				CstNpBscInfoVO cstNpBscInfoVO = this.cstNpBscInfoService.selectById(prjBsc.getCstId());
				if(null != cstNpBscInfoVO){
					view.addObject("certValidSDt", cstNpBscInfoVO.getCertValidSDt());
					view.addObject("certValidEDt", cstNpBscInfoVO.getCertValidEDt());
				}
			}
			String cstTypCd = "";
			if (StringUtils.isNotBlank(id)) {
				CstBscInfoVO cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
						.valueOf(id));
				if (null != cstBscInfoVO) {
					cstTypCd = cstBscInfoVO.getCstTypCd();
				}
			}
			view.addObject("cstTypCd", cstTypCd);

			//二手车特殊判断
			view.addObject("prjTypMdfFlag", "1");//项目类型可修改
			if (PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) ||
					PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd) ||
					PrjBscInfoConstant.PRJ_TYP_CD_OWNJYD.equals(prjTypCd)) {
				if (StringUtils.isNotBlank(prjBsc.getPrjStsCd()) && !FlowConstant.FLOW_CHECK_STATE_NON.equals(prjBsc.getPrjStsCd())) {
					view.addObject("prjTypMdfFlag", "0");//项目类型不可修改
				}
			}

			//网商支付宝账号
			if(StringUtils.isNotBlank(prjBsc.getInsCode())&&PrjBscInfoConstant.PRJ_INS_CODE_WS.equals(prjBsc.getInsCode())){
				if(null != prjBsc.getPrjCstAccInfoVO()){
					view.addObject("wsAccNo", prjBsc.getPrjCstAccInfoVO().getAccNo());
				}
			}

			logger.info("add,项目详情 到修改页面 :: prjBscInfo.getInsCode() = " + prjBsc.getInsCode());

			//筛选信息控制
			List<SysDictionaryDTO> sysDictionaryDTOS = this.insRouteBscInfoService.searchRouteCheck();
			logger.info("保存项目信息.资管路由验证sysDictionaryDTOS：{},id:{},操作人:{}",JSON.toJSONString(sysDictionaryDTOS) ,id,CurrentThreadContext.getCurrentUserName());
			if(CollectionUtils.isNotEmpty(sysDictionaryDTOS)){
				for (SysDictionaryDTO sysDictionaryDTO : sysDictionaryDTOS){
					String code = sysDictionaryDTO.getCode();
					if(StringUtils.isNotBlank(code)){
						String[] split = code.split("-");
						if(split.length == 2
								&&split[0].equals(prjBsc.getPrjTypCd())
								&& split[1].equals(prjBsc.getBuOrgCd())){
							view.addObject("routeCheck",BaseConstant.IS_YESNO_YES);
						}
					}
				}
			}

			// 查找资管机构模块配置
			if(StringUtils.isNotBlank(prjBsc.getInsCode())) {

				//TODO 这里判断是不是三井住友资管 如果是 则判断客户信息是不是法人 如果是法人则不查询资管机构模块配置
				if(PrjBscInfoConstant.PRJ_INS_CODE_SMBC.equals(prjBsc.getInsCode()) && CustomerConstant.CST_TYP_CD_CORP.equals(prjBsc.getCstTypCd())){

					logger.info("toModifyPage.项目申请初始化修改页面.查找资管机构模块配置是三井友住并且是法人:insCode={},prjBsc={},currentUserName={}" , prjBsc.getInsCode(), prjBsc, CurrentThreadContext.getCurrentUserName());

				}else {

					logger.info("toModifyPage.项目申请初始化修改页面.查找资管机构模块配置Start:insCode={},prjBsc={},currentUserName={}" , prjBsc.getInsCode(), prjBsc, CurrentThreadContext.getCurrentUserName());
					SysInsTabCfgVO sysInsTabCfgVO = this.sysInsTabCfgService.selectByInsCode(prjBsc.getInsCode());
					logger.info("toModifyPage.项目申请初始化修改页面.查找资管机构模块配置End:insCode={},sysInsTabCfgVO={},currentUserName={}" , prjBsc.getInsCode(), sysInsTabCfgVO, CurrentThreadContext.getCurrentUserName());

					if(sysInsTabCfgVO != null) {
						view.addObject("sysInsTabCfgVO", sysInsTabCfgVO);
					}
				}

			}
			//商家轻卡 经销商报单员姓名+手机号
            if (PrjBscInfoConstant.LCV_TYP_CD.equals(prjBsc.getPrjTypCd())) {
                StringBuffer stringBuffer = new StringBuffer();
                String crtUsrNm = prjBsc.getCrtUsrNm();
                if (StringUtils.isNotEmpty(crtUsrNm)) {
                    stringBuffer.append(crtUsrNm);
                }
                Long crtUsrId = prjBsc.getCrtUsrId();
                //查询用户信息
                if (StringUtils.isNotEmpty(crtUsrId)) {
                    SysUsrVO usrVo = this.sysUsrService.selectById(crtUsrId,CurrentThreadContext.getCurrentSysCd());
                    String mp = usrVo.getMp();
                    if (StringUtils.isNotEmpty(mp)) {
                        stringBuffer.append(mp);
                    }
                }
                String sp = stringBuffer.toString();
                view.addObject("sp", sp);
            }

			//当前事业部下支持预筛选的项目类型list
			JSONArray prjTypCdAllowedList = new JSONArray();
			//预筛选强校验关联项目类型
			JSONArray prjTypCdAllowedMap = new JSONArray();
			//预筛选路由配置list
			List<SysDictionaryDTO> preRouteConfList = this.sysDictionaryApiService.searchGroupAll(CurrentThreadContext.getCurrentSysCd(),CurrentThreadContext.getCurrentOrgCd(),"PRJ0254");
			logger.info("加载PrjBscInfo add页面,preRouteConfList:{}", JSON.toJSONString(preRouteConfList));
			if(CollectionUtils.isNotEmpty(preRouteConfList)){
				for (SysDictionaryDTO sysDictionaryDTO: preRouteConfList){
					JSONObject prjTypCdAllowedInfo = new JSONObject();
					prjTypCdAllowedInfo.put("prjTypCd",sysDictionaryDTO.getCode());
					prjTypCdAllowedInfo.put("preStrCheckFlag",sysDictionaryDTO.getCodeAttr1());
					prjTypCdAllowedMap.add(prjTypCdAllowedInfo);
					prjTypCdAllowedList.add(sysDictionaryDTO.getCode());
				}
			}

			logger.info("加载PrjBscInfo add页面,prjTypCdAllowedList:{},prjTypCdAllowedMap:{}",JSON.toJSONString(prjTypCdAllowedList),JSON.toJSONString(prjTypCdAllowedMap));
			view.addObject("prjTypCdAllowedList",prjTypCdAllowedList);
			view.addObject("prjTypCdAllowedMap",prjTypCdAllowedMap);
            //预筛选规则强校验flag
			/**
            SysCtrlCfgQueryCondition qc = new SysCtrlCfgQueryCondition();
            qc.setSysCd(WebBaseConstant.SYS_SYS_CD);
            qc.setOrgCd("00000");
            qc.setCtrlCode("PRE_ROUTE_0002");
            logger.info("加载PrjBscInfo add页面,预筛选规则强校验 params:{}",JSON.toJSONString(qc));
            String preStrCheckFlag = this.sysCtrlCfgApiService.searchSysCtrlCfgByCtrlCode(qc);
            logger.info("加载PrjBscInfo add页面,预筛选规则强校验 result:{}",preStrCheckFlag);
            view.addObject("preStrCheckFlag",preStrCheckFlag);
			 */
            view.addObject("preRouteInsNm", prjBsc.getFundRasInsNm());
			view.addObject("fundRasInsId", prjBsc.getFundRasInsId());
			//添加业务线字典后的机构名称
			view.addObject("friBaseList", friBaseInfoVOList);
            view.addObject("preRouteIdOld", prjBsc.getPreRouteId());
            view.addObject("preResIdOld", prjBsc.getPreResId());
			return view;
		}
		catch(Exception ex) {
			ex.printStackTrace();
			throw ex;
		}
	}

    @RequestMapping(value = "/getPreInsInfoByPrjId.do", method = { RequestMethod.GET,RequestMethod.POST })
    @ResponseBody
    public Object getPreInsInfoByPrjId(HttpServletRequest request, HttpServletResponse response){
        List<PreRouteBscInfoDTO> preBscInfoList = new ArrayList<PreRouteBscInfoDTO>();
	    //通过客户Id,客户经理ID，所属事业部ID预筛选结果信息
        Long cstId = 0L;
        Long cstMgrId = 0L;
        String buOrgCd = "";
        Pager page = new Pager();
        PreRouteBscInfoQC qc = new PreRouteBscInfoQC();
        qc.setCstId(cstId);
        qc.setCstMgrId(cstMgrId);
        qc.setBuOrgCd(buOrgCd);
        page.setCondition(qc);
        Pager pager = this.preRouteQueryApiService.selectPreRouteBscInfoListPageWithResult(page);
        if(CollectionUtils.isEmpty(pager.getResultList())){
            logger.info("selectByCstId预筛选记录为空!操作人:{}", CurrentThreadContext.getCurrentUserName());
            return preBscInfoList;
        }
        preBscInfoList = (List<PreRouteBscInfoDTO>)pager.getResultList();
        return PreRouteBscInfoVOTransform.toVOList(preBscInfoList);
    }


	/**
	 * **************************考察照片**************************
	 */
	/**
	 * 初始化考察照片列表
	 */
	@RequestMapping(value = "/initSurveyList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initSurveyList(HttpServletRequest request,
								 HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prjId = request.getParameter("prjId");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		if (StringUtils.isNotBlank(prjId)) {

		}
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		// 查询项目的事业部
		PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long
				.valueOf(prjId));
		if (null != prjBsc) {
			orgCd = prjBsc.getBuOrgCd();
		}

		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		String cstType = "";
		if (StringUtils.isNotBlank(prjId)) {
			CstBscInfoVO cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
					.valueOf(prjId));
			if (null != cstBscInfoVO) {
				cstType = cstBscInfoVO.getCstTypCd();
			}
		}

		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_NP);
			qc.setCfgCdList(codeList);
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_LP);
			qc.setCfgCdList(codeList);
		}
		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		SysUlDatCfgVO cfg = null;
		if (CollectionUtils.isNotEmpty(list)) {
			cfg = list.get(0);
		}
		List<SysUlDatCfgDtlVO> dtlList = cfg.getSysUlDatCfgDtlVOList();
		SysUlFilesRecQueryCondition ulFileQc = new SysUlFilesRecQueryCondition();
		ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
		ulFileQc.setSysCd(qc.getSysCd());
		ulFileQc.setOrgCd(orgCd);
		ulFileQc.setPkId(prjId);
		ulFileQc.setTabNm("PRJ_BSC_INFO");
		List<SysUlFilesRecVO> fileList = sysUlFilesRecService
				.searchList(ulFileQc);
		if (CollectionUtils.isNotEmpty(dtlList)) {
			for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : dtlList) {
				if (CollectionUtils.isNotEmpty(fileList)) {
					for (SysUlFilesRecVO sysUlFilesRecVO : fileList) {
						if (sysUlDatCfgDtlVO.getCfgDtlCd().equals(
								sysUlFilesRecVO.getCfgDtlCd())
								&& sysUlDatCfgDtlVO.getCfgCd().equals(
								sysUlFilesRecVO.getCfgCd())) {
							sysUlDatCfgDtlVO.setFileRec(sysUlFilesRecVO);
							break;
						}
					}
				}
			}
		}

		ListPageVO<SysUlDatCfgDtlVO> listPage = new ListPageVO<SysUlDatCfgDtlVO>(
				dtlList, dtlList.size());
		return listPage;
	}

	/**
	 * 初始化考察照片列表
	 */
	@RequestMapping(value = "/initGuarSurveyList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initGuarSurveyList(HttpServletRequest request,
									 HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prjCstId = request.getParameter("prjCstId");
		String cstType = request.getParameter("cstTypCd");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();

		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_GUAR_SURVEY_PHOTO_NP);
			qc.setCfgCdList(codeList);
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_GUAR_SURVEY_PHOTO_LP);
			qc.setCfgCdList(codeList);
		}
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		PrjCstBscInfoVO prjCstBscInfoVO = this.prjCstBscInfoService
				.selectById(Long.valueOf(prjCstId));
		if (null != prjCstBscInfoVO) {
			// 查询项目的事业部
			PrjBscInfoVO prjBsc = this.prjBscInfoService
					.selectById(prjCstBscInfoVO.getPrjId());
			if (null != prjBsc) {
				orgCd = prjBsc.getBuOrgCd();
			}
		}
		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		SysUlDatCfgVO cfg = null;
		if (CollectionUtils.isNotEmpty(list)) {
			cfg = list.get(0);
		}
		List<SysUlDatCfgDtlVO> dtlList = cfg.getSysUlDatCfgDtlVOList();
		SysUlFilesRecQueryCondition ulFileQc = new SysUlFilesRecQueryCondition();
		ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
		ulFileQc.setSysCd(qc.getSysCd());
		ulFileQc.setOrgCd(orgCd);
		ulFileQc.setPkId(prjCstId);
		ulFileQc.setTabNm("PRJ_CST_BSC_INFO");
		List<SysUlFilesRecVO> fileList = sysUlFilesRecService
				.searchList(ulFileQc);

		if (CollectionUtils.isNotEmpty(dtlList)) {
			for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : dtlList) {
				if (CollectionUtils.isNotEmpty(fileList)) {
					for (SysUlFilesRecVO sysUlFilesRecVO : fileList) {
						if (sysUlDatCfgDtlVO.getCfgDtlCd().equals(
								sysUlFilesRecVO.getCfgDtlCd())
								&& sysUlDatCfgDtlVO.getCfgCd().equals(
								sysUlFilesRecVO.getCfgCd())) {
							sysUlDatCfgDtlVO.setFileRec(sysUlFilesRecVO);
							break;
						}
					}
				}
			}
		}

		ListPageVO<SysUlDatCfgDtlVO> listPage = new ListPageVO<SysUlDatCfgDtlVO>(
				dtlList, dtlList.size());
		return listPage;
	}

	/**
	 * 到担保人考察照片列表页面
	 */
	@RequestMapping(value = "/toGuarProjectSurveyPhotosList.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toGuarProjectSurveyPhotosList(
			HttpServletRequest request, HttpServletResponse response) {
		logger.info("到考察照片列表页面.");
		String prjCstId = request.getParameter("prjCstId");
		String detailFlag = request.getParameter("detailFlag");
		String cstTypCd = request.getParameter("cstTypCd");// 分类
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/projectGuarSurveyPhotosList");
		view.addObject("prjCstId", prjCstId);
		view.addObject("detailFlag", detailFlag);
		view.addObject("cstTypCd", cstTypCd);// 产品分类
		return view;
	}

	/**
	 * 到考察照片列表页面
	 */
	@RequestMapping(value = "/toProjectSurveyPhotosList.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toProjectSurveyPhotosList(HttpServletRequest request,
												  HttpServletResponse response) {
		logger.info("到考察照片列表页面.");
		String prjId = request.getParameter("prjId");
		String detailFlag = request.getParameter("detailFlag");
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/projectSurveyPhotosList");
		view.addObject("prjId", prjId);
		view.addObject("detailFlag", detailFlag);
		return view;
	}

	/**
	 * 到添加照片列表页面
	 */
	@RequestMapping(value = "/addInvestImgPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView addSurveyPage(HttpServletRequest request,
									  HttpServletResponse response) {
		logger.info("到添加考察照片列表页面.");
		String prjId = request.getParameter("prjId");
		String detailFlag = request.getParameter("detailFlag");
		String sysCd = request.getParameter("sysCd");
		String orgCd = request.getParameter("orgCd");
		String cfgCd = request.getParameter("cfgCd");
		String cfgDtlCd = request.getParameter("cfgDtlCd");
		// String cfgDtId = request.getParameter("cfgDtId");
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/addInvestImgPage");
		view.addObject("prjId", prjId);
		view.addObject("sysCd", sysCd);
		view.addObject("orgCd", orgCd);
		view.addObject("cfgCd", cfgCd);
		view.addObject("cfgDtlCd", cfgDtlCd);
		// view.addObject("cfgDtId", cfgDtId);
		view.addObject("detailFlag", detailFlag);
		return view;
	}

	/**
	 * 到添加照片列表页面
	 */
	@RequestMapping(value = "/addGuarVisitInvestImgPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView addGuarVisitInvestImgPage(HttpServletRequest request,
												  HttpServletResponse response) {
		logger.info("到添加考察照片列表页面.");
		String prjCstId = request.getParameter("prjCstId");
		String detailFlag = request.getParameter("detailFlag");
		String sysCd = request.getParameter("sysCd");
		String orgCd = request.getParameter("orgCd");
		String cfgCd = request.getParameter("cfgCd");
		String cfgDtlCd = request.getParameter("cfgDtlCd");
		String cfgDtId = request.getParameter("cfgDtId");
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/addGuarVisitInvestImgPage");
		view.addObject("prjCstId", prjCstId);
		view.addObject("sysCd", sysCd);
		view.addObject("orgCd", orgCd);
		view.addObject("cfgCd", cfgCd);
		view.addObject("cfgDtlCd", cfgDtlCd);
		view.addObject("cfgDtId", cfgDtId);
		view.addObject("detailFlag", detailFlag);
		return view;
	}

	/**
	 * 到添加照片列表页面
	 */
	@RequestMapping(value = "/addGuarSurveyInvestImgPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView addGuarSurveyInvestImgPage(HttpServletRequest request,
												   HttpServletResponse response) {
		logger.info("到添加考察照片列表页面.");
		String prjCstId = request.getParameter("prjCstId");
		String detailFlag = request.getParameter("detailFlag");
		String sysCd = request.getParameter("sysCd");
		String orgCd = request.getParameter("orgCd");
		String cfgCd = request.getParameter("cfgCd");
		String cfgDtlCd = request.getParameter("cfgDtlCd");
		String cfgDtId = request.getParameter("cfgDtId");
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/addGuarSurveyInvestImgPage");
		view.addObject("prjCstId", prjCstId);
		view.addObject("sysCd", sysCd);
		view.addObject("orgCd", orgCd);
		view.addObject("cfgCd", cfgCd);
		view.addObject("cfgDtlCd", cfgDtlCd);
		view.addObject("cfgDtId", cfgDtId);
		view.addObject("detailFlag", detailFlag);
		return view;
	}

	/**
	 * 到添加考察照片列表页面
	 */
	@RequestMapping(value = "/toAddSurveyPhotosPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toAddSurveyPhotosPage(HttpServletRequest request,
											  HttpServletResponse response) {
		logger.info("到添加考察照片列表页面.");
		String prjId = request.getParameter("prjId");
		String detailFlag = request.getParameter("detailFlag");
		String cstType = "";
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		if (StringUtils.isNotBlank(prjId)) {
			CstBscInfoVO cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
					.valueOf(prjId));
			if (null != cstBscInfoVO) {
				cstType = cstBscInfoVO.getCstTypCd();
			}
			PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long
					.valueOf(prjId));
			if (null != prjBsc) {
				orgCd = prjBsc.getBuOrgCd();
			}
		}
		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_NP);
			qc.setCfgCdList(codeList);
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_LP);
			qc.setCfgCdList(codeList);
		}

		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());

		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/projectSurveyAdd");
		view.addObject("prjId", prjId);
		view.addObject("list", list);
		view.addObject("detailFlag", detailFlag);
		return view;
	}

	/**
	 * 获取考察照片配置信息
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getFileDatCfg.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object getFileDatCfg(HttpServletRequest request,
								HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");
		String prjId = request.getParameter("prjId");
		if (StringUtils.isEmpty(prjId)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("参数不完整！");
			return result;
		}
		String cstType = "";
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long
				.valueOf(prjId));
		if (null != prjBsc) {
			orgCd = prjBsc.getBuOrgCd();
		}
		if (StringUtils.isNotBlank(prjId)) {
			CstBscInfoVO cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
					.valueOf(prjId));
			if (null != cstBscInfoVO) {
				cstType = cstBscInfoVO.getCstTypCd();
			}

		}
		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_NP);
			qc.setCfgCdList(codeList);
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_LP);
			qc.setCfgCdList(codeList);
		}

		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		try {
			List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
			if (null == list) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("数据不存在！");
			}
			result.setData(list);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		}
		return result;
	}

	/**
	 * 到查看考察照片列表页面
	 */
	@RequestMapping(value = "/toPhotosDetailPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toSurveyPhotosDetailPage(HttpServletRequest request,
												 HttpServletResponse response) {
		logger.info("到查看考察照片列表页面.");
		String id = request.getParameter("id");
		String path = "";
		if (StringUtils.isNotBlank(id)) {
			SysUlFilesRecVO file = this.sysUlFilesRecService.selectById(Long
					.valueOf(id));
			if (null != file) {

				path = /*
				 * PropertiesCacheUtils.getProperty(SysUlFilesRecConstant
				 * .SYS_FILE_UPLOAD_SERVER_PATH)+
				 */file.getFilePath();
			}
		}
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/prjPhotosDetailPage");
		view.addObject("path", path);
		return view;
	}

	/**
	 * 新增考察/家访照片信息
	 */
	@RequestMapping(value = "/addProjectPhoto.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addProjectPhoto(HttpServletRequest request,
								  HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				SysLogConstant.LOG_CMM_ADD_SUCC);
		PrjLnkCompVO entity = null;
		String prjId = request.getParameter("prjId");
		String fileNm = request.getParameter("fileNm");
		String filePath = request.getParameter("filePath");
		String sysCd = request.getParameter("sysCd");
		String orgCd = request.getParameter("orgCd");
		String cfgCd = request.getParameter("cfgCd");
		String cfgDtlCd = request.getParameter("cfgDtlCd");
		Long id = null;
		try {
			SysUlFilesRecVO fileRec = new SysUlFilesRecVO();
			if (StringUtils.isNotBlank(prjId)) {
				fileRec.setPkId(prjId);
			}
			SysUlFilesRecQueryCondition fileQc = new SysUlFilesRecQueryCondition();
			fileQc.setCfgCd(cfgCd);
			fileQc.setPkId(prjId);
			fileQc.setTabNm("PRJ_BSC_INFO");
			fileQc.setOrgCd(orgCd);
			fileQc.setSysCd(sysCd);
			fileQc.setCfgDtlCd(cfgDtlCd);
			// this.sysUlFilesRecService.removeByCondition(fileQc);
			fileRec.setFileNm(fileNm);
			fileRec.setFilePath(filePath);
			fileRec.setSysCd(sysCd);
			fileRec.setOrgCd(orgCd);
			fileRec.setCfgCd(cfgCd);
			fileRec.setCfgDtlCd(cfgDtlCd);
			fileRec.setTabNm("PRJ_BSC_INFO");
			fileRec.setCrtTm(new Date());
			fileRec.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
			fileRec.setMdfTm(new Date());
			fileRec.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
			fileRec.setIsDel(BaseConstant.IS_YESNO_NO);
			// id = this.sysUlFilesRecService.add(fileRec);
			id = this.prjBscInfoService.addFileRec(fileQc, fileRec);
			// 查询保存成功的数据
			SysUlFilesRecVO filesRecVO = this.sysUlFilesRecService
					.selectById(id);
			result.setData(filesRecVO);

			logger.info("add新增数据.id:{}，DATA:{},操作人:{}",id ,JSONObject.toJSONString(entity),CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("新增数据失败.DATA:{},msg:{},操作人:{}",JSONObject.toJSONString(entity),ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			logger.error("新增数据失败.DATA:{},msg:{},操作人:{}",JSONObject.toJSONString(entity),ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 新增担保人考察/家访照片信息
	 */
	@RequestMapping(value = "/addGuarProjectPhoto.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addGuarProjectPhoto(HttpServletRequest request,
									  HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				SysLogConstant.LOG_CMM_ADD_SUCC);
		PrjLnkCompVO entity = null;
		String prjCstId = request.getParameter("prjCstId");
		String fileNm = request.getParameter("fileNm");
		String filePath = request.getParameter("filePath");
		String sysCd = request.getParameter("sysCd");
		String orgCd = request.getParameter("orgCd");
		String cfgCd = request.getParameter("cfgCd");
		String cfgDtlCd = request.getParameter("cfgDtlCd");
		Long id = null;
		try {
			SysUlFilesRecVO fileRec = new SysUlFilesRecVO();
			if (StringUtils.isNotBlank(prjCstId)) {
				fileRec.setPkId(prjCstId);
			}
			SysUlFilesRecQueryCondition fileQc = new SysUlFilesRecQueryCondition();
			fileQc.setCfgCd(cfgCd);
			fileQc.setPkId(prjCstId);
			fileQc.setTabNm("PRJ_CST_BSC_INFO");
			fileQc.setOrgCd(orgCd);
			fileQc.setSysCd(sysCd);
			fileQc.setCfgDtlCd(cfgDtlCd);
			this.sysUlFilesRecService.removeByCondition(fileQc);
			fileRec.setFileNm(fileNm);
			fileRec.setFilePath(filePath);
			fileRec.setSysCd(sysCd);
			fileRec.setOrgCd(orgCd);
			fileRec.setCfgCd(cfgCd);
			fileRec.setCfgDtlCd(cfgDtlCd);
			fileRec.setTabNm("PRJ_CST_BSC_INFO");
			fileRec.setCrtTm(new Date());
			fileRec.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
			fileRec.setMdfTm(new Date());
			fileRec.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
			fileRec.setIsDel(BaseConstant.IS_YESNO_NO);
			fileRec.setAbsLocPath(PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_ROOT_PATH)+filePath);

			id = this.sysUlFilesRecService.add(fileRec);
			// 查询保存成功的数据
			SysUlFilesRecVO filesRecVO = this.sysUlFilesRecService
					.selectById(id);
			result.setData(filesRecVO);

			logger.info("新增数据.id:{},entity:{},操作人:{}",id,JSONObject.toJSONString(entity),CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("新增数据失败.DATA:{},msg:{},操作人:{}" + JSONObject.toJSONString(entity),ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			logger.error("新增数据失败.DATA:{},msg:{},操作人：{}",JSONObject.toJSONString(entity),ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * **************************家访照片**************************;
	 */
	/**
	 * 初始化家访照片列表
	 */
	@RequestMapping(value = "/initVisitList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initVisitList(HttpServletRequest request,
								HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prjId = request.getParameter("prjId");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		String cstType = "";
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		if (StringUtils.isNotBlank(prjId)) {
			CstBscInfoVO cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
					.valueOf(prjId));
			if (null != cstBscInfoVO) {
				cstType = cstBscInfoVO.getCstTypCd();
			}
		}
		PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long
				.valueOf(prjId));
		if (null != prjBsc) {
			orgCd = prjBsc.getBuOrgCd();
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_VISIT_PHOTO_NP);
			qc.setCfgCdList(codeList);
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_VISIT_PHOTO_LP);
			qc.setCfgCdList(codeList);
		}

		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());

		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		SysUlDatCfgVO cfg = null;
		if (CollectionUtils.isNotEmpty(list)) {
			cfg = list.get(0);
		}
		List<SysUlDatCfgDtlVO> dtlList = cfg.getSysUlDatCfgDtlVOList();
		SysUlFilesRecQueryCondition ulFileQc = new SysUlFilesRecQueryCondition();
		ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
		ulFileQc.setSysCd(qc.getSysCd());
		ulFileQc.setOrgCd(orgCd);
		ulFileQc.setPkId(prjId);
		List<SysUlFilesRecVO> fileList = sysUlFilesRecService
				.searchList(ulFileQc);
		if (CollectionUtils.isNotEmpty(dtlList)) {
			for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : dtlList) {
				if (CollectionUtils.isNotEmpty(fileList)) {
					for (SysUlFilesRecVO sysUlFilesRecVO : fileList) {
						if (sysUlDatCfgDtlVO.getCfgDtlCd().equals(
								sysUlFilesRecVO.getCfgDtlCd())
								&& sysUlDatCfgDtlVO.getCfgCd().equals(
								sysUlFilesRecVO.getCfgCd())) {
							sysUlDatCfgDtlVO.setFileRec(sysUlFilesRecVO);
							break;
						}
					}
				}
			}
		}

		ListPageVO<SysUlDatCfgDtlVO> listPage = new ListPageVO<SysUlDatCfgDtlVO>(
				dtlList, dtlList.size());
		return listPage;
	}

	/**
	 * 初始化家访照片列表
	 */
	@RequestMapping(value = "/initGuarVisitList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initGuarVisitList(HttpServletRequest request,
									HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prjCstId = request.getParameter("prjCstId");
		String cstType = request.getParameter("cstTypCd");// 客户分类
		Pager page = new Pager();
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_GUAR_VISIT_PHOTO_NP);
			qc.setCfgCdList(codeList);
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_GUAR_VISIT_PHOTO_LP);
			qc.setCfgCdList(codeList);
		}

		PrjCstBscInfoVO prjCstBscInfoVO = this.prjCstBscInfoService
				.selectById(Long.valueOf(prjCstId));
		if (null != prjCstBscInfoVO) {
			PrjBscInfoVO prjBsc = this.prjBscInfoService
					.selectById(prjCstBscInfoVO.getPrjId());
			if (null != prjBsc) {
				orgCd = prjBsc.getBuOrgCd();
			}
		}
		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());

		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		SysUlDatCfgVO cfg = null;
		if (CollectionUtils.isNotEmpty(list)) {
			cfg = list.get(0);
		}
		List<SysUlDatCfgDtlVO> dtlList = cfg.getSysUlDatCfgDtlVOList();
		SysUlFilesRecQueryCondition ulFileQc = new SysUlFilesRecQueryCondition();
		ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
		ulFileQc.setSysCd(qc.getSysCd());
		ulFileQc.setOrgCd(orgCd);
		ulFileQc.setPkId(prjCstId);
		List<SysUlFilesRecVO> fileList = sysUlFilesRecService
				.searchList(ulFileQc);
		if (CollectionUtils.isNotEmpty(dtlList)) {
			for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : dtlList) {
				if (CollectionUtils.isNotEmpty(fileList)) {
					for (SysUlFilesRecVO sysUlFilesRecVO : fileList) {
						if (sysUlDatCfgDtlVO.getCfgDtlCd().equals(
								sysUlFilesRecVO.getCfgDtlCd())
								&& sysUlDatCfgDtlVO.getCfgCd().equals(
								sysUlFilesRecVO.getCfgCd())) {
							sysUlDatCfgDtlVO.setFileRec(sysUlFilesRecVO);
							break;
						}
					}
				}
			}
		}

		ListPageVO<SysUlDatCfgDtlVO> listPage = new ListPageVO<SysUlDatCfgDtlVO>(
				dtlList, dtlList.size());
		return listPage;
	}

	/**
	 * 到担保人家访照片列表页面
	 */
	@RequestMapping(value = "/toGuarProjectVisitPhotosList.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toGuarProjectVisitPhotosList(
			HttpServletRequest request, HttpServletResponse response) {
		logger.info("到家访照片列表页面.");
		String prjCstId = request.getParameter("prjCstId");// 项目客户ID
		String detailFlag = request.getParameter("detailFlag");
		String cstTypCd = request.getParameter("cstTypCd");// 客户分类
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/projectGuarVisitPhotosList");
		view.addObject("prjCstId", prjCstId);
		view.addObject("detailFlag", detailFlag);
		view.addObject("cstTypCd", cstTypCd);
		return view;
	}

	/**
	 * 到家访照片列表页面
	 */
	@RequestMapping(value = "/toProjectVisitPhotosList.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toProjectVisitPhotosList(HttpServletRequest request,
												 HttpServletResponse response) {
		logger.info("到家访照片列表页面.");
		String prjId = request.getParameter("prjId");
		String detailFlag = request.getParameter("detailFlag");
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/projectVisitPhotosList");
		view.addObject("prjId", prjId);
		view.addObject("detailFlag", detailFlag);
		return view;
	}

	/**
	 * 到添加家访照片列表页面
	 */
	@RequestMapping(value = "/toAddVisitPhotosPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toAddVisitPhotosPage(HttpServletRequest request,
											 HttpServletResponse response) {
		logger.info("到添加家访照片列表页面.");
		String prjId = request.getParameter("prjId");
		String detailFlag = request.getParameter("detailFlag");
		String cstType = "";
		if (StringUtils.isNotBlank(prjId)) {
			CstBscInfoVO cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
					.valueOf(prjId));
			if (null != cstBscInfoVO) {
				cstType = cstBscInfoVO.getCstTypCd();
			}
		}
		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_NP);
			qc.setCfgCdList(codeList);
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_LP);
			qc.setCfgCdList(codeList);
		}
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long
				.valueOf(prjId));
		if (null != prjBsc) {
			orgCd = prjBsc.getBuOrgCd();
		}
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/projectVisitAdd");
		view.addObject("prjId", prjId);
		view.addObject("list", list);
		view.addObject("detailFlag", detailFlag);
		return view;
	}

	/**
	 * 获取家访照片配置信息
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getVisitFileDatCfg.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object getVisitFileDatCfg(HttpServletRequest request,
									 HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");
		String prjId = request.getParameter("prjId");
		if (StringUtils.isEmpty(prjId)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("参数不完整！");
			return result;
		}
		String cstType = "";
		if (StringUtils.isNotBlank(prjId)) {
			CstBscInfoVO cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
					.valueOf(prjId));
			if (null != cstBscInfoVO) {
				cstType = cstBscInfoVO.getCstTypCd();
			}
		}
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long
				.valueOf(prjId));
		if (null != prjBsc) {
			orgCd = prjBsc.getBuOrgCd();
		}
		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_VISIT_PHOTO_NP);
			qc.setCfgCdList(codeList);
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_VISIT_PHOTO_LP);
			qc.setCfgCdList(codeList);
		}

		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		try {
			List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
			if (null == list) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("数据不存在！");
			}
			result.setData(list);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！msg:{}", ex.getMessage());
		}
		return result;
	}

	/**
	 * 到查看家访照片列表页面
	 */
	@RequestMapping(value = "/toVisitPhotosDetailPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toVisitPhotosDetailPage(HttpServletRequest request,
												HttpServletResponse response) {
		logger.info("到查看家访照片列表页面.");
		String id = request.getParameter("id");
		String path = "";
		if (StringUtils.isNotBlank(id)) {
			SysUlFilesRecVO file = this.sysUlFilesRecService.selectById(Long
					.valueOf(id));

			if (null != file) {
				path = file.getFilePath();
			}
		}
		ModelAndView view = new ModelAndView(
				"project/prjInvestRpt/projectVisitDetail");
		view.addObject("path", path);
		return view;
	}

	/**
	 * 到详细页面
	 */
	@RequestMapping(value = "/toProtBacInfoDetailPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toProtBacInfoDetailPage(HttpServletRequest request,
												HttpServletResponse response) {
		String prdDetailId = request.getParameter("id");// 详细产品ID；
		String prdId = request.getParameter("prdId");// 商品ID
		if ("101".equals(request.getParameter("pianflag"))) {
			//融资外部机构专用
			ModelAndView view = new ModelAndView("project/prjbscinfo/projectPrjBscInfoDetail_W");
			view.addObject("pianflag",request.getParameter("pianflag"));
			view.addObject("id",request.getParameter("id"));
			view.addObject("contractNo",request.getParameter("contractNo"));
			return view;
		}
		PrdBscInfoVO prdBscInfo = this.prjBscInfoService
				.getPrdBscAndPrdDetailInfo(prdId, prdDetailId);
		logger.info("toProtBacInfoDetailPage跳转到项目详情页面.操作人:{}",CurrentThreadContext.getCurrentUserName());
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectPrjBscInfoDetail");


		view.addObject("prdDetailId", prdDetailId);
		view.addObject("prdId", prdId);
		view.addObject("prdBscInfo", prdBscInfo);

		return view;
	}

	/**
	 * 初始化卡车列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initPrdTkList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initPrdTkList(HttpServletRequest request,
								HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prdNm = request.getParameter("prdNm");
		String prdTypCd = request.getParameter("prdTypCd");
		String prdCd = request.getParameter("prdCd");
		String prdMdl = request.getParameter("prdMdl");
		String mfrId = request.getParameter("mfrNm");
		String brCd = request.getParameter("brCd");
		String prdId = request.getParameter("prdId");// 主产品ID
		// String audStsCd = request.getParameter("audStsCd");
		String audStsCdStr = request.getParameter("audStsCdList");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(pageSize)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		if (StringUtils.isEmpty(prdTypCd)) {
			List<PrdTkInfoVO> list = new ArrayList<PrdTkInfoVO>();
			ListPageVO<PrdTkInfoVO> listPage = new ListPageVO<PrdTkInfoVO>(
					list, list.size());
			return listPage;
		}
		PrdTkInfoQueryCondition qc = new PrdTkInfoQueryCondition();
		if (StringUtils.isNotBlank(prdNm)) {
			qc.setPrdNm(prdNm);
		}
		if (StringUtils.isNotBlank(mfrId)) {
			qc.setMfrId(Long.valueOf(mfrId));
		}
		if (StringUtils.isNotBlank(prdCd)) {
			qc.setPrdCd(prdCd);
		}
		if (StringUtils.isNotBlank(prdTypCd)) {
			qc.setPrdTypCd(prdTypCd);
		}
		if (StringUtils.isNotBlank(prdMdl)) {
			qc.setPrdMdl(prdMdl);
		}
		if (StringUtils.isNotBlank(brCd)) {
			qc.setBrCd(brCd);
		}
		if (StringUtils.isNotBlank(prdId)) {
			qc.setPrdId(Long.valueOf(prdId));
		}
		// qc.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_PASS);
		List<String> audStsCdList = new ArrayList<String>();
		JSONArray audStsArray = JSONArray.fromObject(audStsCdStr);
		for (Object object : audStsArray) {
			audStsCdList.add(object.toString());
		}
		// qc.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_PASS);
		qc.setAudStsCdList(audStsCdList);
		page.setCondition(qc);
		Pager pager = this.prjBscInfoService.getPrdTKInfoPage(page);
		List<PrdTkInfoVO> list = (List<PrdTkInfoVO>) pager.getResultList();
		ListPageVO<PrdTkInfoVO> listPage = new ListPageVO<PrdTkInfoVO>(list,
				pager.getTotalCount());
		return listPage;
	}

	/**
	 * 初始化客车列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initPrdCarList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initPrjPrdList(HttpServletRequest request,
								 HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prdNm = request.getParameter("prdNm");
		String prdTypCd = request.getParameter("prdTypCd");
		String prdMdl = request.getParameter("prdMdl");
		String mfrId = request.getParameter("mfrId");//厂商ID
		String mfrNm = request.getParameter("mfrNm");
		String brCd = request.getParameter("brCd");
		String prdId = request.getParameter("prdId");// 产品ID
		String prdCd = request.getParameter("prdCd");// 产品具体分类
		String audStsCdStr = request.getParameter("audStsCdList");
		String seatQtyCd = request.getParameter("seatQtyCd");//座位数
		String carLen = request.getParameter("carLen");//车身长度
		String brCdSelect = request.getParameter("brCdSelect");
		String carTypSelect = request.getParameter("carTypSelect");
		// brCdSelect = URLDecoder.decode(brCdSelect);
		// String audStsCd = request.getParameter("audStsCd");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(pageSize)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrdCarInfoQueryCondition qc = new PrdCarInfoQueryCondition();

		if (StringUtils.isNotBlank(brCdSelect)) {
			qc.setBrCd(brCdSelect);
		}
		if (StringUtils.isNotBlank(carTypSelect)) {
			qc.setPrdMdl(carTypSelect);
		}

		if (StringUtils.isNotBlank(prdNm)) {
			qc.setPrdNm(prdNm);
		}
		if (StringUtils.isNotBlank(prdCd)) {
			qc.setPrdCd(prdCd);
		}
		if (StringUtils.isNotBlank(prdTypCd)) {
			qc.setPrdTypCd(prdTypCd);
		}
		if (StringUtils.isNotBlank(prdMdl)) {
			qc.setPrdMdl(prdMdl);
		}
		if (StringUtils.isNotBlank(prdId)) {
			qc.setPrdId(Long.valueOf(prdId));
		}
		if (StringUtils.isNotBlank(mfrNm)) {
			qc.setMfrNm(mfrNm);
		}
		if (StringUtils.isNotBlank(mfrId)) {
			qc.setMfrId(mfrId);
		}

		if (StringUtils.isNotBlank(brCd)) {
			qc.setBrCd(brCd);
		}
		List<String> audStsCdList = new ArrayList<String>();
		JSONArray audStsArray = JSONArray.fromObject(audStsCdStr);
		for (Object object : audStsArray) {
			audStsCdList.add(object.toString());
		}
		// qc.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_PASS);
		qc.setAudStsCdList(audStsCdList);
		page.setCondition(qc);
		Pager pager = this.prjBscInfoService.getPrdCarInfoPage(page);
		List<PrdBscInfoVO> list = (List<PrdBscInfoVO>) pager.getResultList();
		ListPageVO<PrdBscInfoVO> listPage = new ListPageVO<PrdBscInfoVO>(list,
				pager.getTotalCount());
		return listPage;
	}

	/**
	 * 初始化列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initList(HttpServletRequest request,
						   HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prjNm = request.getParameter("prjNm");
		String cstNm = request.getParameter("cstNm");
		String prjTyCd = request.getParameter("prjTypCd");
		String bizTypCd = request.getParameter("bizTypCd");
		String prjStsCd = request.getParameter("prjStsCd");
		String buOrgCd = request.getParameter("buOrgCd");// 事业部
		String cstId = request.getParameter("cstId");// 客户ID
		String splId = request.getParameter("splId");// 供应商ID(YAOXIURONG)
		String lsCntNo = request.getParameter("lsCntNo");
		String lnkCompId = request.getParameter("lnkCompId");// 挂靠公司ID
		String cstMgrNm = request.getParameter("cstMgrNm");// 客户经理
		String cntTypCd = request.getParameter("cntTypCd");
		String isDel = request.getParameter("isDel");//是否删除
		String cstMgrOrgCd = request.getParameter("cstMgrOrgCd");
		String userNm = request.getParameter("userNm");
		String ovdViewFlag = request.getParameter("ovdViewFlag");
		String cstMgrId = request.getParameter("cstMgrId");
		String mfrId = request.getParameter("mfrId");//厂商ID
		String insCode = request.getParameter("insCode");
		String fundRasInsId = request.getParameter("fundRasInsId");
		String stDt = request.getParameter("stDt");
		String endDt = request.getParameter("endDt");
		// 是否厂商业务
		String isSplMfr = request.getParameter("isSplMfr");
		String cstMgrRgnCd = request.getParameter("cstMgrRgnCd");
		//是否资管业务
        String isInsBiz = request.getParameter("isInsBiz");
        String compensatoryType = request.getParameter("compensatoryType");

        Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrjBscInfoQueryCondition qc = new PrjBscInfoQueryCondition();
		if (StringUtils.isNotEmpty(cstMgrRgnCd)) {
			qc.setCstMgrRgnCd(cstMgrRgnCd);
		}
		if (StringUtils.isNotEmpty(isSplMfr)) {
			qc.setIsSplMfr(Long.valueOf(isSplMfr));
		}
		if(StringUtils.isNotBlank(stDt)){
			qc.setStDt(DateUtils.formatStringToDate(stDt, DateUtils.YYYY_MM_DD));
		}
		if(StringUtils.isNotBlank(endDt)){
			qc.setEndDt(DateUtils.formatStringToDate(endDt, DateUtils.YYYY_MM_DD));
		}
		if(StringUtils.isNotBlank(fundRasInsId)){
			qc.setFundRasInsId(Long.valueOf(fundRasInsId));
		}
		if(StringUtils.isNotBlank(insCode)){
			qc.setInsCode(insCode);
		}
		if (StringUtils.isNotBlank(cstMgrOrgCd)) {
			qc.setCstMgrOrgCd(cstMgrOrgCd);
		}
		if (StringUtils.isNotBlank(buOrgCd)) {
			qc.setBuOrgCd(buOrgCd);
		}
		if(StringUtils.isNotBlank(isDel)){
			qc.setIsDel(Integer.valueOf(isDel));
		}
		if (StringUtils.isNotBlank(lsCntNo)) {
			qc.setLsCntNo(lsCntNo);
		}
		if (StringUtils.isNotBlank(cntTypCd)) {
			qc.setCntTypCd(cntTypCd);
		}
		if (StringUtils.isNotBlank(cstMgrNm)) {
			qc.setCstMgrNm(cstMgrNm);
		}
		if (StringUtils.isNotBlank(lnkCompId)) {
			qc.setCompLnkId(Long.valueOf(lnkCompId));
		}
		if (StringUtils.isNotBlank(prjNm)) {
			qc.setPrjNm(prjNm);
		}
		if (StringUtils.isNotBlank(cstNm)) {
			qc.setCstNm(cstNm);
		}
		if (StringUtils.isNotBlank(prjTyCd)) {
			qc.setPrjTypCd(prjTyCd);
		}
		if (StringUtils.isNotBlank(bizTypCd)) {
			qc.setBizTypCd(bizTypCd);
		}
		if (StringUtils.isNotBlank(prjStsCd)) {
			List list = new ArrayList();
			if (prjStsCd.equals(FlowConstant.FLOW_CHECK_STATE_NON)) {
				qc.setDefPrjStsCd(prjStsCd);
			} else if (prjStsCd.equals(FlowConstant.FLOW_CHECK_STATE_IN)){
				list.add(FlowConstant.FLOW_CHECK_STATE_IN);
				list.add(FlowConstant.FLOW_CHECK_STATE_PRE_IN);
				list.add(FlowConstant.FLOW_CHECK_STATE_PRE_PASS);
				list.add(FlowConstant.FLOW_CHECK_STATE_PRE_REJECT);
				qc.setPrjStsCdList(list);
			} else if (prjStsCd.equals(FlowConstant.FLOW_CHECK_STATE_NO_PASS)) {
				list.add(FlowConstant.FLOW_CHECK_STATE_NO_PASS);
				list.add(FlowConstant.FLOW_CHECK_STATE_PRE_NO_PASS);
				qc.setPrjStsCdList(list);
			} else {
				qc.setPrjStsCd(prjStsCd);
			}
			qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		}
		if (StringUtils.isNotEmpty(cstId) && StringUtils.isNumeric(cstId)) {
			List<Long> cstIdList = new ArrayList<>();
			cstIdList.add(Long.valueOf(cstId));
			qc.setCstIdList(cstIdList);
		}
		if (StringUtils.isNotEmpty(splId) && StringUtils.isNumeric(splId)) {
			qc.setSplId(Long.valueOf(splId));// YAOXIURONG
		}
		if (StringUtils.isNotEmpty(mfrId) && StringUtils.isNumeric(mfrId)) {
			qc.setMfrId(Long.valueOf(mfrId));// tsn
		}
		if (StringUtils.isNotEmpty(userNm)) {
			qc.setUserNm(userNm);
		}
		qc.setUsrId(CurrentThreadContext.getCurrentUserId());
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		if(StringUtils.isNotEmpty(cstMgrId)){
			qc.setCstMgrId(Long.parseLong(cstMgrId));
		}
        if (StringUtils.isNotEmpty(isInsBiz)) {
            qc.setIsInsBiz(Integer.valueOf(isInsBiz));
        }
		if (StringUtils.isNotEmpty(compensatoryType)) {
			qc.setCompensatoryType(compensatoryType);
		}
		page.setCondition(qc);
		Pager pager = this.prjBscInfoService.searchListPage(page);
		List<PrjBscInfoVO> list = (List<PrjBscInfoVO>) pager.getResultList();
		if(CollectionUtils.isNotEmpty(list) && "ovdViewFlag".equals(ovdViewFlag)){
			this.prjBscInfoService.putOvdDataToPrjBscInfo(list);
		}
		//资管机构名称后添加业务线字典
		if (CollectionUtils.isNotEmpty(list)) {
			//业务线字典List
			List<KeyValueVO> bussinessLineDicList = sysDictionaryApiService.getKvList("REF0048","11000","0000");
			//查询第三方机构
			List<FriBaseInfoVO> friBaseInfoVOList = this.overdueService.getFriBaseInfoList();
			//根据金融机构业务线,设置金融机构名称展示字段值
			FundRasInsNmChangeUtil.insNmShowAddBussinessLineDic(friBaseInfoVOList,bussinessLineDicList);
			if (CollectionUtils.isNotEmpty(friBaseInfoVOList)) {
				for (PrjBscInfoVO prjBscInfoVOTemp : list) {
					if (StringUtils.isEmpty(prjBscInfoVOTemp.getFundRasInsId())) {
						continue;
					}
					for (FriBaseInfoVO friBaseInfoVOTemp : friBaseInfoVOList) {
						if (StringUtils.isNotEmpty(friBaseInfoVOTemp.getId()) && StringUtils.isNotEmpty(friBaseInfoVOTemp.getFundRasInsNmShow())
								&& friBaseInfoVOTemp.getId().longValue() == prjBscInfoVOTemp.getFundRasInsId().longValue()) {
							prjBscInfoVOTemp.setFundRasInsNm(friBaseInfoVOTemp.getFundRasInsNmShow());
							break;
						}
					}
				}
			}
		}
		ListPageVO<PrjBscInfoVO> listPage = new ListPageVO<PrjBscInfoVO>(list,
				pager.getTotalCount());
		return listPage;
	}

	/**
	 * 得到一条记录
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getById.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object getById(HttpServletRequest request,
						  HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");
		if (StringUtils.isEmpty(id)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("参数不完整！");
			return result;
		}

		try {
			PrjBscInfoVO vo = this.prjBscInfoService.selectById(Long
					.valueOf(id));
			if (null == vo) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("数据不存在！");
			}else{
				String pian = request.getParameter("pian"); //外部机构标识101
				if(StringUtils.isNotEmpty(pian) && "101".equals(pian) && StringUtils.isNotEmpty(vo.getRcCstBscInfoId())){
					//查询系统数据库里的历史征信评级（不涉及调用接口）
					RcCstBscInfoDTO rcDto = this.riskCtrlSearchApiService.getRcCstBscInfoByIdWithDic(vo.getRcCstBscInfoId(), CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
					if(null != rcDto){
						vo.setRskLvlCdNm(rcDto.getRskLvlCdNm());
					}
				}
			}
			result.setData(vo);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error(ex.getMessage(), ex);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！", ex);
		}
		return result;
	}

	/**
	 * 通过组织机构ID获取客户经理列表
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getCstMgrListByOrgId.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object getCstMgrListByOrgId(HttpServletRequest request,
									   HttpServletResponse response) throws BaseException {
		String orgCd = request.getParameter("orgCd");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");
		if (StringUtils.isEmpty(orgCd)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("请先选择组织机构！");
			return result;
		}
		try {
			List<SysUsrVO> actMgrList = this.prjBscInfoService
					.getCstMgrListByOrgId(orgCd);
			if (null == actMgrList) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("数据不存在！");
			}
			result.setData(actMgrList);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error(ex.getMessage(), ex);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			// result.setInfo("获取数据失败！");
			logger.error("获取数据失败！", ex);
		}
		return result;
	}

	/**
	 * 查询二手车折旧率
	 *
	 * @param request
	 * @return rate
	 * @throws Exception
	 */
	@RequestMapping(value = "/getDiscountRate.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object getDiscountRate(HttpServletRequest request,
								  HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");
		String month = request.getParameter("month");// 折旧月份
		double rate = 0d;
		try {
			if (StringUtils.isNotBlank(month)) {
				Map<String, String> map = this.prjBscInfoService
						.getDiscountRate();
				if (!map.isEmpty()) {
					if (map.containsKey(month)) {
						rate = Double.valueOf(map.get(month));
					}
				}
			}
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("未查到该月的折旧率信息！");
			logger.error(ex.getMessage(), ex);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("未查到该月的折旧率信息！");
			logger.error("获取数据失败！", ex);
		}
		result.setData(rate);
		return result;
	}

	/**
	 * 获取挂靠公司信息
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getLnkCompList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object getLnkCompList(HttpServletRequest request,
								 HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"获取成功");

		try {
			PrjLnkCompQueryCondition qc = new PrjLnkCompQueryCondition();
			// qc.setAudStsCd(BaseConstant.FLOW_CHECK_STATE_PASS);
			List<PrjLnkCompVO> prjLnkCompList = this.prjLnkCompService
					.getPrjLnkCompByCondition(qc);
			if (null == prjLnkCompList) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("数据不存在！");
			}
			result.setData(prjLnkCompList);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error(ex.getMessage(), ex);
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			logger.error("获取数据失败！", ex);
		}
		return result;
	}

	/**
	 * 新增
	 */
	@RequestMapping(value = "/add.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object add(HttpServletRequest request, HttpServletResponse response)
			throws BaseException {
		logger.info("add立项申请新增 user:{}"+CurrentThreadContext.getCurrentUserName());
		logger.info("add","立项申请新增 区域:{},名称:{}",CurrentThreadContext.getCurrentRgnDivCd(),CurrentThreadContext.getCurrentRgnDivCdNm());

		String prjId = request.getParameter("prjId");
		String isFlow = request.getParameter("isFlow");
		String compensatoryType = request.getParameter("compensatoryType");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,"新增成功!");
		List<FriBaseInfoVO> friBaseInfoList = null;
		try {
			boolean flag = false;
            /**
             * 预筛选项目关联标志
             * 修改项目
             *      1.普通项目-->预筛选项目(更新预筛选机构筛选状态为已占用)
             *      2.预筛选项目-->普通项目(更新预筛选机构筛选状态为未占用)
             *      3.预筛选项目-->预筛选项目(原筛选状态置为未占用,现筛选状态置为已占用)
             * 新增项目
             *      1.预筛选项目(更新预筛选机构筛选状态为已占用)
             */
            boolean preRouteFlag = false;
			PrjBscInfoVO prjBscInfo = getPrjBscInfoRequestParams(request);
			String prjBuOrgCd = "";
			String prjTypCd=prjBscInfo.getPrjTypCd();
			String cstMgrOrgCd = prjBscInfo.getCstMgrOrgCd();
			String cstId= prjBscInfo.getCstId().toString();
			String insCode = prjBscInfo.getInsCode();
			String CstNm = prjBscInfo.getCstNm();

            String preRouteId = request.getParameter("preRouteId");//预筛选记录ID
            String preResId = request.getParameter("preResId");//预筛选结果ID
            Long preResIdOldValue = null;//之前预筛选结果ID
            Long preResIdValue = null;//现预筛选结果ID
            //String preResIdOld = request.getParameter("preResIdOld");//之前预筛选结果ID
            //获取前筛选记录ID
			if(StringUtils.isNotBlank(prjId)){
				PrjBscInfoVO getPreResIdVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
				if(getPreResIdVO != null){
                    if(getPreResIdVO.getPreResId() != null){
                        preResIdOldValue = Long.valueOf(getPreResIdVO.getPreResId());
						if(preResIdOldValue != null){
							//有效筛选结果
							preRouteFlag = true;
						}
                    }
                }
            }
			/**
			 * 是否预筛选
			 * 1.进行预筛选,机构信息从预筛选从取值
			 * 2.无预筛选
			 *   2.1 机构ID为空,我司业务
			 *   2.2 机构ID不为空,资管业务
			 */
			logger.info("项目保存 add. 项目ID={},preRouteId={},preResId={},preResIdOldValue={},参数:{}",prjId,preRouteId,preResId,preResIdOldValue,JSON.toJSONString(prjBscInfo));
			if (StringUtils.isNotBlank(preRouteId) && StringUtils.isNotBlank(preResId)) {
				preRouteFlag = true;
                preResIdValue = Long.valueOf(preResId);
				PreRouteInsResQC preRouteInsResQC = new PreRouteInsResQC();
				preRouteInsResQC.setId(Long.valueOf(preResId));
				List<PreRouteInsResVO> preRouteInsResVOList = PreRouteInsResVOTransform.toVOList(this.preRouteQueryApiService.selectPreRouteInsResDTOByCondition(preRouteInsResQC));
				logger.info("preRouteQueryApiService.selectPreRouteInsResDTOByCondition result:{}",JSON.toJSONString(preRouteInsResVOList));
				if (CollectionUtils.isEmpty(preRouteInsResVOList)) {
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("筛选记录对应的资管信息异常,请检查！");
                    return result;
                }
                if("2".equals(preRouteInsResVOList.get(0).getResSts())){
                    result.setSuccess(BaseConstant.IS_YESNO_NO);
                    result.setInfo("筛选记录已占用，请重新选择！");
                    return result;
                }
                prjBscInfo.setPreRouteId(Long.valueOf(preRouteId));
                prjBscInfo.setPreResId(Long.valueOf(preResId));
			} else {
				prjBscInfo.setPreRouteId(0l);
				prjBscInfo.setPreResId(0l);
				if (prjBscInfo.getFundRasInsId() == null) {
					prjBscInfo.setFundRasInsId(0l);
					prjBscInfo.setInsCode("");
					prjBscInfo.setFundRasInsNm("");
				}
			}

            /**
             * REQ-14514 修复资管项目资管机构名称带业务线字典入库问题
             * 机构名称取值机构基本信息表
             */
            if (null != prjBscInfo && null != prjBscInfo.getFundRasInsId() && 0 != prjBscInfo.getFundRasInsId()) {
                FriBaseInfoQueryCondition friBaseInfoQC = new FriBaseInfoQueryCondition();
                friBaseInfoQC.setId(prjBscInfo.getFundRasInsId());
                List<FriBaseInfoVO> friBaseInfoVOList = this.friBaseInfoService.searchList(friBaseInfoQC);
                if (CollectionUtils.isNotEmpty(friBaseInfoVOList)) {
                    prjBscInfo.setFundRasInsNm(friBaseInfoVOList.get(0).getFundRasInsNm());
                }
            } else {
				prjBscInfo.setFundRasInsId(0l);
				prjBscInfo.setInsCode("");
				prjBscInfo.setFundRasInsNm("");
			}

			int isInsBiz = prjBscInfo.getIsInsBiz();
			PrjBscInfoVO prjBscInfoVO = null;
			if(StringUtils.isBlank(prjId)){
				prjBuOrgCd = CurrentThreadContext.getCurrentBuOrgCd();
			}else{
				prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
				prjBuOrgCd = prjBscInfoVO.getBuOrgCd();
				cstMgrOrgCd = prjBscInfoVO.getCstMgrOrgCd();
				if(!cstId.equals(prjBscInfoVO.getCstId().toString())||(!prjTypCd.equals(prjBscInfoVO.getPrjTypCd()))){
					flag = true;
				}
			}
			PrjCheckResultDTO checkResultDTO = 	prjBscInfoService.searchRcCstBscInfoList(prjBuOrgCd, prjTypCd, Long.valueOf(cstId),cstMgrOrgCd,StringUtils.isBlank(prjId)?null:Long.valueOf(prjId),flag,insCode);
			if(StringUtils.isNotBlank(insCode)&&null!=checkResultDTO&&
					null!=checkResultDTO.getIsChkRcCstPrj()&&checkResultDTO.getIsChkRcCstPrj()==BaseConstant.IS_YESNO_NO){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请查询配偶的征信信息！");
			}
            List<PrjPaySchMYqVO> PrjPaySchMYqVOList = new ArrayList();
			if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWYQ.equals(prjTypCd)){
                 PrjPaySchMYqVOList = getYqVOListRequestParams( request,null,prjBuOrgCd,prjTypCd);
            }
			logger.info("立项申请新增===二手车资管===prjBuOrgCd:{},isInsBiz:{},prjTypCd{}",prjBuOrgCd,isInsBiz,prjTypCd);
			/*if (PrjBscInfoConstant.CODE_BU_ORG_CD_ZK.equals(prjBuOrgCd) && (PrjBscInfoConstant.PRJ_TYP_CD_CDDYWUL.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD.equals(prjTypCd))) {
				if (1 == isInsBiz) {
					FriBaseInfoQueryCondition qc = new FriBaseInfoQueryCondition();
					qc.setInsSts(FriBaseInfoConstant.FRI_BASE_INFO_INS_STS_PASS);
					qc.setInsUseCd("2");
					qc.setInsCode(PrjBscInfoConstant.PRJ_INS_CODE_JXFL);
					qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
					qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
					friBaseInfoList = this.friBaseInfoService.searchList(qc);
					logger.info("add", "立项申请新增===二手车资管===friBaseInfoList：" + JSON.toJSON(friBaseInfoList));
					if (CollectionUtils.isNotEmpty(friBaseInfoList)) {
						FriBaseInfoVO friBaseInfo = friBaseInfoList.get(0);
						prjBscInfo.setFundRasInsId(friBaseInfo.getId());
						prjBscInfo.setFundRasInsNm(friBaseInfo.getFundRasInsNm());
						prjBscInfo.setInsCode(friBaseInfo.getInsCode());
					}
				} else {
					prjBscInfo.setFundRasInsId(0l);
					prjBscInfo.setFundRasInsNm("");
					prjBscInfo.setInsCode("");
				}
			}*/
			/**
			 * 疫情贷项目
			 */
			if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWYQ.equals(prjTypCd)){
				prjBscInfo.setPrjPaySchMYqVOList(PrjPaySchMYqVOList);
			}
			if (StringUtils.isNotBlank(prjId)) {
				// 修改
				//PrjBscInfoVO prjBscInfoVO1 = this.prjBscInfoService.selectById(Long.valueOf(prjId));
				if(null!=prjBscInfoVO&&prjBscInfoVO.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_QCJR)){
					if(prjBscInfo.getPrjTypCd().equals(PrjBscInfoConstant.CODE_PRJ_TYP_CD_BILLING_CD)||prjBscInfoVO.getPrjTypCd().equals(PrjBscInfoConstant.CODE_PRJ_TYP_CD_BILLING_CD)){
						PrjQuatPrpsQueryCondition qc = new PrjQuatPrpsQueryCondition();
						qc.setPrjId(Long.valueOf(prjId));
						qc.setIsFormalPrps(BaseConstant.IS_YESNO_YES);
						List<PrjQuatPrpsVO> qList = this.prjQuatPrpsService.searchList(qc);
						if(CollectionUtils.isNotEmpty(qList)){
							//throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "修改项目类型会影响方案信息，请核查！");
							prjBscInfo.setIsHaveQuat(BaseConstant.IS_YESNO_YES);
						}else{
							prjBscInfo.setIsHaveQuat(BaseConstant.IS_YESNO_NO);
						}
					}
				}
				prjBscInfo.setIsChkRcCstPrj(0);
				prjBscInfo.setMdfTm(new Date());
				prjBscInfo.setId(Long.valueOf(prjId));
				prjBscInfo.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
                prjBscInfo.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
				//先修改项目进行规则校验
				if(StringUtils.isNotEmpty(isFlow) && "1".equals(isFlow)){
					this.prjBscInfoService.modify(prjBscInfo);
					if(preRouteFlag){
                        boolean modPreRouteStsFlag = this.preRouteModifyApiService.modifyPreRouteSts(Long.valueOf(prjId),preResIdOldValue,preResIdValue);
                        logger.info("add,modPreRouteStsFlag：{}",modPreRouteStsFlag);
						boolean chgSts = this.insRouteBscInfoService.changePreInsResInfo(Long.valueOf(prjId), preResIdOldValue, preResIdValue);
						logger.info("add,changePreInsResInfo：{}",chgSts);
					}
					result.setSuccess(BaseConstant.IS_YESNO_YES);
					result.setInfo("修改成功!");
				}else{
					String buOrgCd = WebBaseUtils.getBuOrgCd(prjBscInfo.getOrgCd());
					prjBscInfo.setBuOrgCd(buOrgCd);
					prjBscInfo.setCrtTm(prjBscInfoVO.getCrtTm());
					prjBscInfo.setRcCstBscInfoId(prjBscInfoVO.getRcCstBscInfoId());
					prjBscInfo.setPledge(prjBscInfo.getPledge());//是否需要抵押
					prjBscInfo.setMainGdsTypCd(prjBscInfo.getMainGdsTypCd());//主货物大类
					prjBscInfo.setGoodsRes(prjBscInfo.getGoodsRes());//主运输货物
					this.prjBscInfoService.modify(prjBscInfo);
                    if(preRouteFlag){
                        boolean modPreRouteStsFlag = this.preRouteModifyApiService.modifyPreRouteSts(Long.valueOf(prjId),preResIdOldValue,preResIdValue);
                        logger.info("add,modPreRouteStsFlag:{}",modPreRouteStsFlag);
						boolean chgSts = this.insRouteBscInfoService.changePreInsResInfo(Long.valueOf(prjId), preResIdOldValue, preResIdValue);
						logger.info("add,changePreInsResInfo:{}",chgSts);
                    }
					//REQ-14961如果特殊业务类型选择的无,清空代偿担保支付账户
					PrjPrdBscInfoQueryCondition prdQc = new PrjPrdBscInfoQueryCondition();
					prdQc.setPrjId(Long.valueOf(prjId));
					List<PrjPrdBscInfoVO> prjprdList = this.prjPrdBscInfoService.searchList(prdQc);
					if(CollectionUtils.isNotEmpty(prjprdList)&&prjprdList.size()>1){
						List<Long> prjPrdIdList = new ArrayList<Long>();
						for (PrjPrdBscInfoVO prd : prjprdList) {
							prjPrdIdList.add(prd.getId());
						}
						PrjSplBankAccRQueryCondition compensatoryBankQc =  new PrjSplBankAccRQueryCondition();
						compensatoryBankQc.setPrjPrdIds(prjPrdIdList);
						compensatoryBankQc.setPurpCd(PrjPrdBscInfoConstant.COMPENSATORY_BANK_NO_TYP);
						List<PrjSplBankAccRVO> compensatoryBankList = this.prjSplBankAccRService.searchList(compensatoryBankQc);
						if(CollectionUtils.isNotEmpty(compensatoryBankList)){
							for (PrjSplBankAccRVO prjSplBankAccRVO : compensatoryBankList) {
								//删除返利账号信息
								this.prjSplBankAccRService.removeById(prjSplBankAccRVO.getId());
							}
						}
					}
//删除返利账号信息
					result.setSuccess(BaseConstant.IS_YESNO_YES);
					result.setInfo("修改成功!");
				}
				//项目更换客户或项目类型由二手车更换为非二手车时，需作废预审信息
				PrjPreAudInfoQueryCondition condition = new PrjPreAudInfoQueryCondition();
				condition.setPrjId(Long.valueOf(prjId));
				condition.setIsDel(0);
				logger.info("修改项目信息时查询预审信息 prjId:{}", prjId);
				ResponseData<List<PrjPreAudInfoDTO>> listResponseData = prjPreAudInfoApiService.selectList(condition);
				logger.info("修改项目信息时查询预审信息End prjId:{}, result:{}", prjId, JSON.toJSONString(listResponseData));
				if (null != listResponseData && listResponseData.getCode().equals(ResponseData.SUCCESS_CODE) && CollectionUtils.isNotEmpty(listResponseData.getData())){
					PrjPreAudInfoDTO dto = listResponseData.getData().get(0);
					Boolean isNeedDel = false;
					if (!Objects.equals(dto.getCstId(),prjBscInfo.getCstId())){
						isNeedDel = true;
					}
					if (!Objects.equals(prjTypCd,prjBscInfoVO.getPrjTypCd())){
						isNeedDel = true;
					}
					if (isNeedDel){
						logger.info("更改客户时需作废原有预审信息 prjId:{},oldCstId:{},newCstId:{}",prjId,dto.getCstId(),prjBscInfo.getCstId());
						ResponseData<Integer> deleteByprjId = prjPreAudInfoApiService.deleteByprjId(Long.valueOf(prjId));
						logger.info("更改客户时需作废原有预审信息 prjId:{},result:{}",prjId,JSON.toJSONString(deleteByprjId));
					}
				}
				result.setData(prjBscInfo);
			} else {
				prjBscInfo.setPrjStsCd(PrjBscInfoConstant.CODE_AUD_STS_NOT_AUDI_CD);
				prjBscInfo.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
				prjBscInfo.setCrtUsrNm(CurrentThreadContext.getCurrentUserName());
				prjBscInfo.setCstMgrRgnCd(CurrentThreadContext.getCurrentRgnDivCd());
				prjBscInfo.setCrtTm(new Date());
				prjBscInfo.setIsDel(BaseConstant.IS_YESNO_NO);
				prjBscInfo.setPledge(prjBscInfo.getPledge());//是否需要抵押
				prjBscInfo.setMainGdsTypCd(prjBscInfo.getMainGdsTypCd());//主货物大类
				prjBscInfo.setGoodsRes(prjBscInfo.getGoodsRes());//主运输货物
                prjBscInfo.setIsAllowNonIns(IsAllowNonInsBizEnum.IS_YESNO_NO.code);//资管业务特批
                logger.info("add,立项申请新增 prjBscInfo:{}",JSON.toJSONString(prjBscInfo));
				Long id = this.prjBscInfoService.add(prjBscInfo);
                if(preRouteFlag){
                    boolean modPreRouteStsFlag = this.preRouteModifyApiService.modifyPreRouteSts(id,preResIdOldValue,preResIdValue);
                    logger.info("add,modPreRouteStsFlag:{}",modPreRouteStsFlag);
					boolean chgSts = this.insRouteBscInfoService.changePreInsResInfo(id, preResIdOldValue, preResIdValue);
					logger.info("add,changePreInsResInfo:{}",chgSts);
                }
				prjBscInfo.setId(id);
				result.setData(prjBscInfo);
			}
            /*if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWYQ.equals(prjTypCd)){
                if(prjBscInfo != null && StringUtils.isNotEmpty(prjBscInfo.getId())){
						for(PrjPaySchMYqVO yqVO : PrjPaySchMYqVOList){
							yqVO.setPrjId(prjBscInfo.getId());
						}
                }else{
                	throw new BaseException("保存项目开始处理疫情支付表数据，项目id未空");
				}
                // 保存疫情数据
				this.prjPaySchMYqApiService.batchInsertByAddPrj(PrjPaySchMYqVOTransform.toDTOList(PrjPaySchMYqVOList));

            }*/
			//筛选信息控制
			List<SysDictionaryDTO> sysDictionaryDTOS = this.insRouteBscInfoService.searchRouteCheck();
			logger.info("checkRoute,保存项目信息.资管路由验证sysDictionaryDTOS:{},prjId:{},操作人:{}",JSON.toJSONString(sysDictionaryDTOS),prjId,CurrentThreadContext.getCurrentUserName());
			if(CollectionUtils.isNotEmpty(sysDictionaryDTOS)){
				for (SysDictionaryDTO sysDictionaryDTO : sysDictionaryDTOS){
					String code = sysDictionaryDTO.getCode();
					if(StringUtils.isNotBlank(code)){
						String[] split = code.split("-");
						if(split.length == 2
								&&split[0].equals(prjBscInfo.getPrjTypCd())
								&& split[1].equals(prjBscInfo.getBuOrgCd())){
							prjBscInfo.setRouteCheck(BaseConstant.IS_YESNO_YES);
						}
					}
				}
			}

			// 查找资管机构模块配置
			if(prjBscInfo != null && StringUtils.isNotBlank(prjBscInfo.getInsCode())) {
				SysInsTabCfgVO sysInsTabCfgVO = sysInsTabCfgService.selectByInsCode(prjBscInfo.getInsCode());
				if(sysInsTabCfgVO != null) {
					prjBscInfo.setSysInsTabCfgVO(sysInsTabCfgVO);
				}
			}

		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("add项目基本信息保存失败.msg:{}",ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("新增失败!");
			logger.error("add项目基本信息保存失败,msg:{}",ex.getMessage());
		}

		return result;
	}

	private List<PrjPaySchMYqVO> getYqVOListRequestParams(HttpServletRequest request,Long prjId ,String prjBuOrgCd,String prjTypCd){
		if(PrjBscInfoConstant.PRJ_TYP_CD_CDDYWYQ.equals(prjTypCd)){
			if(PrjBscInfoConstant.CODE_BU_ORG_CD_XNY.equals(prjBuOrgCd) ){
				throw new BaseException("车抵贷疫情项目不支持新能源事业部");
			}
			String checkPaySchYQList = request.getParameter("checkPaySchYQList");
			if(StringUtils.isEmpty(checkPaySchYQList)){
				throw new BaseException("请选择发起疫情项目的支付表！");
			}
			List<PrjPaySchMYqVO> list = new ArrayList<>();
			list = JSON.parseArray(checkPaySchYQList,PrjPaySchMYqVO.class);
			return list;
		}else{
            return null ;
        }
	}

	private PrjBscInfoVO getPrjBscInfoRequestParams(HttpServletRequest request) {
		PrjBscInfoVO bscInfo = new PrjBscInfoVO();
		/*
		 * String prjNm = request.getParameter("prjNm");//项目名称
		 */String orgCd = request.getParameter("orgCd");// 组织机构ID
		String cstMgrId = request.getParameter("cstMgrId");// 客户经理
		/*
		 * String dsCd = request.getParameter("dsCd");//数据来源
		 */String prjTypCd = request.getParameter("prjTypCd");// 项目类型
		String bizTypCd = request.getParameter("bizTypCd");// 业务类型
		String agntTypCd = request.getParameter("agntTypCd");// 代理商类型
		String isGrpBiz = request.getParameter("isGrpBiz");// 是否团单
		String bizResCd = request.getParameter("bizResCd");// 业务来源
		String investTypCd = request.getParameter("investTypCd");// 实地调查类型
		String deductWayCd = request.getParameter("deductWayCd");// 保证金抵扣方式
		String insSol = request.getParameter("insSol");// 保险方案
		String refereeTel = request.getParameter("refereeTel");// 推荐人联系方式
		String purpose = request.getParameter("purpose");// 申请融资租赁目的
		String repayWay = request.getParameter("repayWay");// 还款来源
		String guarMsr = request.getParameter("guarMsr"); // 担保措施
		String othLsDesc = request.getParameter("othLsDesc");// 租赁物及其他可抵押物概况
		String prjRem = request.getParameter("prjRem");// 备注

		String rgnPrCd = request.getParameter("rgnPrCd");//省 
		String rgnCyCd =request.getParameter("rgnCyCd"); //市
		String cstMgrOrgCd = request.getParameter("cstMgrOrgCd");// 客户经理组织机构
		String cstMgrNm = request.getParameter("cstMgrNm");// 客户经理名称
		String cstId = request.getParameter("cstId");// 客户id
		/*
		 * String loanTypCd = request.getParameter( "loanTypCd");//业务种类
		 */String prjIndCd = request.getParameter("prjIndCd");// 租赁物用途
		String prjOthIndCd = request.getParameter("prjOthIndCd");
		String prjIndCdZc = request.getParameter("prjIndCdZc");//租赁物用途(专车)
		String cstNm = request.getParameter("cstNm");// 客户名称
		String cntTypCd = request.getParameter("cntTypCd");// 合同签署方式
		String subBizTypCd = request.getParameter("subBizTypCd");// 业务类型
		String bizModCd = request.getParameter("bizModCd");// 业务形式
		String buyType = request.getParameter("buyType"); //采购类型

		String fundRasInsId = request.getParameter("fundRasInsId");//机构ID
		String fundRasInsNm = request.getParameter("fundRasInsNm");//机构名称
		String insCode = request.getParameter("insCode");//机构编码
		String isHaveUpStruct = request.getParameter("isHaveUpStruct");//是否包含上装
		String cstTypCd = request.getParameter("cstTypCd");//客户类型

		String pledge = request.getParameter("pledge");//是否需要抵押
		String mainGdsTypCd = request.getParameter("mainGdsTypCd");//主货物大类
		String goods = request.getParameter("goods");//主运输货物
		// 是否厂商业务
		String isSplMfr = request.getParameter("isSplMfr");
        String calId = request.getParameter("calId");//厂商报价器ID
        String isInsBiz = request.getParameter("isInsBiz");//是否资管业务
		String homeVisit = request.getParameter("homeVisit");//是否家访
		String isInternalTransfer = request.getParameter("isInternalTransfer");// 是否内部转让
		String compensatoryType = request.getParameter("compensatoryType");// 代偿担保业务类型
		String isBigCstWork = request.getParameter("isBigCstWork");//是否大客户业务
		String bigCstWorkSource = request.getParameter("bigCstWorkSource");//大客户业务来源
		String prjId = request.getParameter("prjId");
		if(StringUtils.isNotBlank(compensatoryType)){
			bscInfo.setCompensatoryType(compensatoryType);
		}
		if(BaseConstant.IS_YESNO_YES_STR.equals(isBigCstWork) && StringUtils.isBlank(bigCstWorkSource)){
			throw new BaseException("大客户业务来源不能为空");
		}
		if(StringUtils.isNotBlank(isBigCstWork)){
			bscInfo.setIsBigCstWork(isBigCstWork);
		}else{
			bscInfo.setIsBigCstWork(BaseConstant.IS_YESNO_NO_STR);
		}
		if(StringUtils.isNotBlank(bigCstWorkSource)){
			bscInfo.setBigCstWorkSource(bigCstWorkSource);
		}else{
			if(StringUtils.isNotBlank(prjId)){
				bscInfo.setBigCstWorkSource(PrjBscInfoConstant.BIG_CST_WORK_99);
			}
		}

        /*
		 * if(StringUtils.isBlank(prjNm)){ throw new
		 * BaseException(BaseExceptionConstant
		 * .BASE_EXCEPTION_CODE_600,"项目名称不能为空！"); }
		 */
		if("0".equals(pledge)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"抵押信息不能为空！");
		}else{
			bscInfo.setPledge(pledge);
		}
		if(StringUtils.isBlank(mainGdsTypCd)&&orgCd.contains("00000001")){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"主货物大类信息不能为空！");
		}else{
			bscInfo.setMainGdsTypCd(mainGdsTypCd);//主货物大类
		}
		if(StringUtils.isBlank(goods)&&orgCd.contains("00000001")){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"主运输货物信息不能为空！");
		}else{
			bscInfo.setGoodsRes(goods);//主运输货物
		}
		if(StringUtils.isNotBlank(isHaveUpStruct)){
			bscInfo.setIsHaveUpStruct(Integer.valueOf(isHaveUpStruct));
		}
		if (StringUtils.isBlank(cstId)) {
			throw new BaseException(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请选择客户！");
		}

		if(StringUtils.isNotBlank(calId)){
            bscInfo.setCalId(Long.valueOf(calId));
        }
		String currBuOrgCd = CurrentThreadContext.getCurrentBuOrgCd();
		if((currBuOrgCd.equals(PrjBscInfoConstant.CODE_BU_ORG_CD_YC))){
			if(StringUtils.isBlank(rgnPrCd)||StringUtils.isBlank(rgnCyCd)){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请选择区域信息！");
			}
		}
		if(currBuOrgCd.equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK)&&StringUtils.isNotBlank(prjTypCd)&&prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_DSFZGCP)
				&&StringUtils.isNotBlank(insCode)
				&&insCode.equals(PrjBscInfoConstant.PRJ_INS_CODE_ICBC)){
			if(StringUtils.isBlank(isHaveUpStruct)){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请选择是否含上装贷！");
			}
		}

		if (StringUtils.isNotEmpty(prjTypCd) && prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_ESCJYD) && StringUtils.isEmpty(isInternalTransfer)){
			throw new BaseException("二手车交易贷业务必须选择是否内部转让");
		}
		if (StringUtils.isNotEmpty(isInternalTransfer)){
			bscInfo.setIsInternalTransfer(Integer.valueOf(isInternalTransfer));
		}
		if (StringUtils.isBlank(cntTypCd)) {
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"合同签署方式不能为空！");
		}

		if(StringUtils.isNotBlank(cstTypCd)){
			if(PrjBscInfoConstant.PRJ_INS_CODE_CCBANKTB.equals(insCode) && !CustomerConstant.CST_TYP_CD_CORP.equals(cstTypCd)){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"建设对公只支持法人业务！");
			}
			if(CustomerConstant.CST_TYP_CD_CORP.equals(cstTypCd)&&cntTypCd.equals(PrjBscInfoConstant.CODE_PRJ_CNT_TYP_CD_ELC) && !PrjBscInfoConstant.PRJ_INS_CODE_CCBANKTB.equals(insCode)){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"法人客户合同签署方式请选择纸质！");
			}
			if(CustomerConstant.CST_TYP_CD_CORP.equals(cstTypCd)&& !(cntTypCd.equals(PrjBscInfoConstant.CODE_PRJ_CNT_TYP_CD_ELC)) && PrjBscInfoConstant.PRJ_INS_CODE_CCBANKTB.equals(insCode)){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"建设对公只支持合同签署方式为电子！");
			}
		}else{
			CstBscInfoVO cstBscInfoVO = this.cstBscInfoService.selectById(Long.valueOf(cstId));
			if(PrjBscInfoConstant.PRJ_INS_CODE_CCBANKTB.equals(insCode) && !CustomerConstant.CST_TYP_CD_CORP.equals(cstBscInfoVO.getCstTypCd())){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"建设对公只支持法人业务！");
			}
			if(cstBscInfoVO.getCstTypCd().equals(CustomerConstant.CST_TYP_CD_CORP)&&cntTypCd.equals(PrjBscInfoConstant.CODE_PRJ_CNT_TYP_CD_ELC) && !PrjBscInfoConstant.PRJ_INS_CODE_CCBANKTB.equals(insCode)){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"法人客户合同签署方式请选择纸质！");
			}
			if(cstBscInfoVO.getCstTypCd().equals(CustomerConstant.CST_TYP_CD_CORP)&&!(cntTypCd.equals(PrjBscInfoConstant.CODE_PRJ_CNT_TYP_CD_ELC)) && PrjBscInfoConstant.PRJ_INS_CODE_CCBANKTB.equals(insCode)){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"建设对公只支持合同签署方式为电子！");
			}
		}

		if(currBuOrgCd.equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK) && (PrjBscInfoConstant.PRJ_TYP_CD_CTYW.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_CPYW.equals(prjTypCd))){
			if(StringUtils.isBlank(compensatoryType)){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"请选择代偿担保业务类型！");
			}
		}
		if(StringUtils.isNotBlank(isSplMfr)){
			bscInfo.setIsSplMfr(Long.valueOf(isSplMfr));
		} else {
			bscInfo.setIsSplMfr(0L);
		}
		if(StringUtils.isNotBlank(fundRasInsId)){
			bscInfo.setFundRasInsId(Long.valueOf(fundRasInsId));
		}else{
			bscInfo.setFundRasInsId(0L);
		}
        if(StringUtils.isNotBlank(isInsBiz)){
            bscInfo.setIsInsBiz(Integer.valueOf(isInsBiz));
        } else {
            //标记2 sql设置null
            bscInfo.setIsInsBiz(2);
        }
		bscInfo.setFundRasInsNm(fundRasInsNm);
		bscInfo.setInsCode(insCode);
		bscInfo.setBizModCd(bizModCd);
		bscInfo.setSubBizTypCd(subBizTypCd);
		bscInfo.setPrjOthIndCd(prjOthIndCd);
		bscInfo.setOrgCd(orgCd);
		bscInfo.setCstNm(cstNm);
		bscInfo.setPrjIndCd(prjIndCd);
		if(StringUtils.isNotBlank(prjIndCdZc)){
			bscInfo.setPrjIndCd(prjIndCdZc);
		}
		bscInfo.setCntTypCd(cntTypCd);
		if (StringUtils.isNotBlank(cstMgrId)) {
			bscInfo.setCstMgrId(Long.valueOf(cstMgrId));
		}
		bscInfo.setCstMgrOrgCd(cstMgrOrgCd);
		bscInfo.setCstMgrNm(cstMgrNm);
		bscInfo.setDsCd(WebBaseConstant.CHANNEL_CD);
		// 数据来源 web
		bscInfo.setPrjTypCd(prjTypCd);
		bscInfo.setBizTypCd(bizTypCd);
       /* if(currBuOrgCd.equals(PrjBscInfoConstant.CODE_BU_ORG_CD_XNY)){
            if(bizTypCd.equals(PrjBscInfoConstant.PRJ_BIZ_TYP_CD_JYXZL)&&!prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CPYW)){
                throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "新能源经营性业务请选择城配业务！");
            }
        }*/
		bscInfo.setAgntTypCd(agntTypCd);
		if (StringUtils.isNotBlank(isGrpBiz)) {
			bscInfo.setIsGrpBiz(Integer.parseInt(isGrpBiz));
		}
		if (StringUtils.isNotBlank(buyType)) {
			bscInfo.setBuyType(buyType);
		}
		bscInfo.setBizResCd(bizResCd);
		bscInfo.setInvestTypCd(investTypCd);
		bscInfo.setDeductWayCd(deductWayCd);
		bscInfo.setInsSol(insSol);
		/*
		 * if(StringUtils.isNotBlank(loanTypCd)){
		 * bscInfo.setLoanTypCd(loanTypCd); }
		 */

		if (StringUtils.isNotBlank(refereeTel)) {
			if (!StringUtils.checkMobileNumber(refereeTel)) {
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "推荐人联系方式不正确！");
			}
		}
		bscInfo.setRefereeTel(refereeTel);

		bscInfo.setPurpose(purpose);
		bscInfo.setRepayWay(repayWay);
		bscInfo.setGuarMsr(guarMsr);
		bscInfo.setOthLsDesc(othLsDesc);
		bscInfo.setPrjRem(prjRem);

		bscInfo.setRgnPrCd(rgnPrCd);
		bscInfo.setRgnCyCd(rgnCyCd);
		if (StringUtils.isNotBlank(homeVisit)){
			bscInfo.setHomeVisit(Integer.parseInt(homeVisit));
		}
		//bscInfo.setPrjNm(prjNm);
      /*  if(StringUtils.isBlank(calId)&&StringUtils.isNotBlank(isSplMfr)&&Integer.valueOf(isSplMfr)==BaseConstant.IS_YESNO_YES){
            throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_604, "厂商业务请先选择一个厂商报价器！");
        }*/

		String bkNo = request.getParameter("bkNo");//开户行号
		String bkNm = request.getParameter("bkNm");//开户银行
		String accNo = request.getParameter("accNo");//银行账号
		String mp = request.getParameter("mp");//银行预留手机号
		String certNo = request.getParameter("certNo");//证件号
		String certTypCd = request.getParameter("certTypCd");//证件类型
		PrjCstAccInfoVO accInfoVO = null;
		if(StringUtils.isNotBlank(insCode)&&PrjBscInfoConstant.PRJ_INS_CODE_ZS.equals(insCode)){
			if(StringUtils.isBlank(bkNo)||StringUtils.isBlank(bkNm)||StringUtils.isBlank(accNo)||StringUtils.isBlank(mp)){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请维护客户银行账户信息！");
			}
			accInfoVO = new PrjCstAccInfoVO();
			accInfoVO.setBkNm(bkNm);
			accInfoVO.setBkNo(bkNo);
			accInfoVO.setAccNo(accNo);
			accInfoVO.setMp(mp);
			accInfoVO.setCstId(Long.valueOf(cstId));
			accInfoVO.setCstNm(cstNm);
			accInfoVO.setCertNo(certNo);
			accInfoVO.setCertTypCd(certTypCd);
			bscInfo.setPrjCstAccInfoVO(accInfoVO);
		}

		if(StringUtils.isNotBlank(insCode)&&PrjBscInfoConstant.PRJ_INS_CODE_WS.equals(insCode)){
			if(StringUtils.isBlank(accNo)){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600, "请维护支付宝账号信息！");
			}
			accInfoVO = new PrjCstAccInfoVO();
			accInfoVO.setAccNo(accNo);
			accInfoVO.setCstId(Long.valueOf(cstId));
			accInfoVO.setCstNm(cstNm);
			bscInfo.setPrjCstAccInfoVO(accInfoVO);
		}

		bscInfo.setCstId(Long.valueOf(cstId));
		bscInfo.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
		bscInfo.setMdfTm(new Date());
		bscInfo.setMdfTm(new Date());
		bscInfo.setMdfTm(new Date());



		return bscInfo;
	}

	/**
	 * 新增
	 */
	@RequestMapping(value = "/addPrdAndPrdDetail.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addPrdAndPrdDetail(HttpServletRequest request,
									 HttpServletResponse response) throws BaseException {
		String prdType = request.getParameter("prdCd");
		String prdBaseInfoId = request.getParameter("prdbscInfoId");
		String rcCstBscInfoId = request.getParameter("rcCstBscInfoId");
		String info = "";
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"新增成功!");
		try {
			// 项目产品基础信息
			PrjPrdBscInfoVO prdBscInfoVO = getPrdBscInfoRequestParams(request);
			prdBscInfoVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
			prdBscInfoVO.setCrtTm(new Date());
			PrjPrdCarInfoVO prdCarInfoVO = null;
			PrjPrdTkInfoVO prdTkInfoVO = null;
			if (StringUtils.isNotBlank(prdType)) {
				prdType = prdType.substring(0, ProductConstant.PRD_TYE_LENGHT);
			}
			if (prdType.equals(ProductConstant.PRD_BUS_CD)
					|| prdType.equals(ProductConstant.PRD_CAR_CD)
					|| prdType.equals(ProductConstant.PRD_TK_CD_11)
					|| prdType.equals(ProductConstant.PRD_TYP_CD_019)
					|| prdType.equals(ProductConstant.PRD_TYP_CD_020)) {
				// 客车信息
				prdCarInfoVO = getPrdCarInfoRequestParams(request);
				prdBscInfoVO.setMarks("0");
			} else {
				// 卡车信息
				prdTkInfoVO = getPrdTkInfoRequestParams(request);
				prdBscInfoVO.setMarks("1");
			}
			//校验配偶征信信息
			String rlRcCstId = null;
			PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(prdBscInfoVO.getPrjId());
			/*//重卡工行卡贷，不能重复插入产品信息
			if(prjBsc.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK)
					&&StringUtils.isNotBlank(prjBsc.getInsCode())
					&&prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_ICBC)
					&&StringUtils.isBlank(prdBaseInfoId)){
				PrjPrdBscInfoQueryCondition prjPrdQc = new PrjPrdBscInfoQueryCondition();
				prjPrdQc.setPrjId(prdBscInfoVO.getPrjId());
				List<PrjPrdBscInfoVO> prjPrdList = this.prjPrdBscInfoService.searchList(prjPrdQc);
				if(CollectionUtils.isNotEmpty(prjPrdList)){
					throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"项目产品已存在，请修改或删除添加其他产品信息！");
				}
			}*/
			if (StringUtils.isNotEmpty(prjBsc.getInsCode()) && prjBsc.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_ICBC)){
				PrjCheckResultDTO checkResult = this.projectApiService.getPrjCheckResult(prjBsc.getCstId(), prdBscInfoVO.getSplId());
				if(StringUtils.isEmpty(checkResult.getResultCode())){

					Map<String, Object> objectMap = checkResult.getRcCstBscInfoMap();
					if (CollectionUtils.isMapEmpty(objectMap)){
						result.setSuccess(BaseConstant.IS_YESNO_NO);
						result.setInfo("未查询到配偶征信信息");
						return result;
					}
					List<RcCstBscInfoDTO> rcCstBscInfoDTOList = (List<RcCstBscInfoDTO>)objectMap.get("rlRcCstBscInfoList");
					if (CollectionUtils.isEmpty(rcCstBscInfoDTOList)){
						result.setSuccess(BaseConstant.IS_YESNO_NO);
						result.setInfo("未查询到配偶征信信息");
						return result;
					}

					for (RcCstBscInfoDTO rcCstBscInfoDTO : rcCstBscInfoDTOList){
						if(rcCstBscInfoDTO.getRskLvlCd().equals("3")){
							result.setSuccess(BaseConstant.IS_YESNO_NO);
							result.setInfo("配偶征信级别低不支持立项");
							return result;
						}
						rlRcCstId = String.valueOf(rcCstBscInfoDTO.getId());
					}
				}
			}
			Long id = null;
			if (StringUtils.isNotBlank(prdBaseInfoId)) {

				// 修改
				prdBscInfoVO.setId(Long.valueOf(prdBaseInfoId));
				prdBscInfoVO.setMdfTm(new Date());
				prdBscInfoVO.setMdfUsrId(CurrentThreadContext
						.getCurrentUserId());
				if (null != prdCarInfoVO) {
					prdCarInfoVO.setId(Long.valueOf(prdBaseInfoId));
					prdCarInfoVO.setMdfTm(new Date());
					prdCarInfoVO.setMdfUsrId(CurrentThreadContext
							.getCurrentUserId());
				}
				if (null != prdTkInfoVO) {
					prdTkInfoVO.setId(Long.valueOf(prdBaseInfoId));
					prdTkInfoVO.setMdfTm(new Date());
					prdTkInfoVO.setMdfUsrId(CurrentThreadContext
							.getCurrentUserId());
				}
				this.prjBscInfoService.modifyPrjPrdBscAndDetailInfo(
						prdBscInfoVO, prdCarInfoVO, prdTkInfoVO);
				info = "修改成功！";
				result = new DataResultVO(BaseConstant.IS_YESNO_YES, info);
			} else {
				// 添加
				prdBscInfoVO.setIsDel(BaseConstant.IS_YESNO_NO);
				prdBscInfoVO.setCrtTm(new Date());
				prdBscInfoVO.setCrtUsrId(CurrentThreadContext
						.getCurrentUserId());
				if (null != prdCarInfoVO) {
					prdCarInfoVO.setCrtTm(new Date());
					prdCarInfoVO.setCrtUsrId(CurrentThreadContext
							.getCurrentUserId());
				}
				if (null != prdTkInfoVO) {
					prdTkInfoVO.setCrtTm(new Date());
					prdTkInfoVO.setCrtUsrId(CurrentThreadContext
							.getCurrentUserId());
				}
				id = this.prjBscInfoService.addPrjPrdBscAndDetailInfo(
						prdBscInfoVO, prdCarInfoVO, prdTkInfoVO);

				info = "添加成功！";
				result = new DataResultVO(BaseConstant.IS_YESNO_YES, info);
			}
			if(StringUtils.isNotEmpty(rcCstBscInfoId)){
				this.projectApiService.modifyPrjBscRcCstInfo(String.valueOf(prdBscInfoVO.getPrjId()), rcCstBscInfoId, "1", rlRcCstId);
			}
			result.setData(id);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("addPrdAndPrdDetail:ERROR:{}",ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("操作失败!");
			logger.error("addPrdAndPrdDetail:ERROR:{}",ex.getMessage());
		}
		return result;
	}

	// 卡车信息
	private PrjPrdTkInfoVO getPrdTkInfoRequestParams(HttpServletRequest request) {
		PrjPrdTkInfoVO prdTkInfoVO = new PrjPrdTkInfoVO();
		// 卡车-主车
		String drvTyp = request.getParameter("drvTypCd");// 驱动形式
		String engMdl = request.getParameter("engMdl");// 发动机型号
		String hp = request.getParameter("hp");// 马力
		String cabSpec = request.getParameter("cabSpec");// 驾驶室规格
		String grboxMdl = request.getParameter("grboxMdl");// 变速箱型号
		String rearAxleSpec = request.getParameter("rearAxleSpec");// 后桥规格
		String mWhlSpec = request.getParameter("mWhlSpec");// 轮胎规格
		String cntrSz = request.getParameter("cntrSz");// 合格证货箱尺寸

		// 卡车-上装/挂车
		String actCntrSz = request.getParameter("actCntrSz");// 货箱(长*宽*高)
		String thickness = request.getParameter("thickness");// 厚度(底*边)(毫米)
		String axleInfo = request.getParameter("axleInfo");// 车轴品牌*数量
		String matQalCd = request.getParameter("matQalCd");// 板材材质
		String doorInfo = request.getParameter("doorInfo");// 开门数及方式
		String trlWhlSpec = request.getParameter("trlWhlSpec");// 轮胎规格*数量
		String cylSepc = request.getParameter("cylSepc");// 油缸规格
		String othInfo = request.getParameter("othInfo");// 其他
		String tankVol = request.getParameter("tankVol");// 罐体有效容积
		String liftWayCd = request.getParameter("liftWayCd");// 举升方式
		String isHvWhl = request.getParameter("isHvWhl");// 是否有轮胎
		String brTypCd = request.getParameter("brTypCd");// 品牌类别
		String prdClsCd = request.getParameter("prdClsCd");// 产品种类
		String buyWayCd = request.getParameter("buyWayCd");// 保险购买方式

		String emiStd = request.getParameter("emiStd");// 主车-排放标准
		String gasCylSpec = request.getParameter("gasCylSpec");// 主车-燃气瓶规格
		String saddleSpec = request.getParameter("saddleSpec");// 主车-鞍座
		String isHvAirCnd = request.getParameter("isHvAirCnd");// 主车-是否有空调
		String whlBase = request.getParameter("whlBase");// 主车-轴距
		String isHvSub = request.getParameter("isHvSub");// 主车-是否有上装
		String clsExfPc = request.getParameter("clsExfPc");// 主车-底盘出厂价格(元)
		String mOthInfo = request.getParameter("mOthInfo");// 主车其他
		String batDeg = request.getParameter("batDeg");
		String seatRowCd = request.getParameter("seatRowCd");
		String fuelTypCd = request.getParameter("fuelTypCd");

		prdTkInfoVO.setmOthInfo(mOthInfo);
		prdTkInfoVO.setEmiStd(emiStd);
		prdTkInfoVO.setGasCylSpec(gasCylSpec);

		if(StringUtils.isNotBlank(fuelTypCd)){
			prdTkInfoVO.setFuelTypCd(fuelTypCd);
		}
		if(StringUtils.isNotBlank(batDeg)){
			prdTkInfoVO.setBatDeg(Double.valueOf(batDeg));
		}
		if(StringUtils.isNotBlank(seatRowCd)){
			prdTkInfoVO.setSeatRowCd(seatRowCd);
		}

		if (StringUtils.isNotBlank(saddleSpec)) {

			prdTkInfoVO.setSaddleSpec(Long.valueOf(saddleSpec));
		}
		if (StringUtils.isNotBlank(isHvAirCnd)) {

			prdTkInfoVO.setIsHvAirCnd(Integer.valueOf(isHvAirCnd));
		}
		prdTkInfoVO.setWhlBase(whlBase);
		if (StringUtils.isNotBlank(isHvSub)) {
			prdTkInfoVO.setIsHvSub(Integer.valueOf(isHvSub));
		}
		if (StringUtils.isNotBlank(clsExfPc)) {
			prdTkInfoVO.setClsExfPc(Long.valueOf(clsExfPc));
		}
		// 主车
		prdTkInfoVO.setDrvTyp(drvTyp);
		prdTkInfoVO.setEngMdl(engMdl);

		prdTkInfoVO.setBrTypCd(brTypCd);
		prdTkInfoVO.setPrdClsCd(prdClsCd);
		prdTkInfoVO.setBuyWayCd(buyWayCd);
		if (StringUtils.isNotEmpty(tankVol)) {
			prdTkInfoVO.setTankVol(tankVol);
		}
		prdTkInfoVO.setCntrSz(cntrSz);

		if (StringUtils.isNotEmpty(hp)) {
			prdTkInfoVO.setHp(Double.valueOf(hp));
		}
		prdTkInfoVO.setCabSpec(cabSpec);
		prdTkInfoVO.setGrboxMdl(grboxMdl);
		prdTkInfoVO.setRearAxleSpec(rearAxleSpec);
		prdTkInfoVO.setMWhlSpec(mWhlSpec);

		// 上装/挂车
		prdTkInfoVO.setActCntrSz(actCntrSz);
		if (StringUtils.isNotEmpty(thickness)) {
			prdTkInfoVO.setThickness(thickness);
		}
		prdTkInfoVO.setAxleInfo(axleInfo);
		prdTkInfoVO.setMatQalCd(matQalCd);
		prdTkInfoVO.setDoorInfo(doorInfo);
		prdTkInfoVO.setTrlWhlSpec(trlWhlSpec);
		prdTkInfoVO.setCylSepc(cylSepc);
		prdTkInfoVO.setOthInfo(othInfo);
		if (StringUtils.isNotEmpty(tankVol)) {
			prdTkInfoVO.setTankVol(tankVol);
		}
		prdTkInfoVO.setLiftWayCd(liftWayCd);
		if (StringUtils.isNotEmpty(isHvWhl)) {
			prdTkInfoVO.setIsHvWhl(Integer.valueOf(isHvWhl));
		}
		prdTkInfoVO.setCrtTm(new Date());
		prdTkInfoVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
		return prdTkInfoVO;
	}

	// 乘用车信息
	private PrjPrdCarInfoVO getPrdCarInfoRequestParams(
			HttpServletRequest request) {
		PrjPrdCarInfoVO prdCarInfoVO = new PrjPrdCarInfoVO();
		// 乘用车
		// String prdSeries = request.getParameter("prdSeries");//车辆编码
		String prdYr = request.getParameter("prdYr");// 生产年份
		String prdCyCd = request.getParameter("prdCyCd");// 国别代码
		String outVol = request.getParameter("outVol");// 排量(L)
		String grboxTypCd = request.getParameter("grboxTypCd");// 变速箱类型代码
		String grboxCfg = request.getParameter("grboxCfg");// 变速箱配置
		String seatQtyCd = request.getParameter("seatQtyCd");// 座位
		String engMdl = request.getParameter("engMdl");// 发动机型号
		String drvTypCd = request.getParameter("drvTypCd");// 驱动形式
		String carStrcCd = request.getParameter("carStrcCd");// 车身结构
		String carStrcCfg = request.getParameter("carStrcCfg");// 车身结构配置
		String powerTypCd = request.getParameter("powerTypCd");// 动力方式
		String carCl = request.getParameter("carCl");// 车身颜色
		String carLen = request.getParameter("carLen");// 车身长度(m)
		String maxSpd = request.getParameter("maxSpd");// 最高车速
		String prdWayCd = request.getParameter("prdWayCd");// 生产方式
		String carMdl = request.getParameter("carMdl");// 车型
		String othCfg = request.getParameter("othCfg");// 其他配置
		String prdLvlCd = request.getParameter("prdLvlCd");//
		String emiStdCd = request.getParameter("emiStdCd");
		String maxHp = request.getParameter("maxHp");
		String cylArr = request.getParameter("cylArr");
		String cylNum = request.getParameter("cylNum");
		String gearsNum = request.getParameter("gearsNum");
		String grboxDesc = request.getParameter("grboxDesc");
		String doorNum = request.getParameter("doorNum");
		String inlMdl = request.getParameter("inlMdl");
		String buyWayCd = request.getParameter("buyWayCd");
		String carVol = request.getParameter("carVol");
		String extMil = request.getParameter("extMil");
		String batDeg = request.getParameter("batDeg");

		if(StringUtils.isNotBlank(carVol)){
			prdCarInfoVO.setCarVol(Double.valueOf(carVol));
		}
		if(StringUtils.isNotBlank(extMil)){
			prdCarInfoVO.setExtMil(Double.valueOf(extMil));
		}
		if(StringUtils.isNotBlank(batDeg)){
			prdCarInfoVO.setBatDeg(Double.valueOf(batDeg));
		}

		prdCarInfoVO.setPrdLvlCd(prdLvlCd);

		prdCarInfoVO.setEmiStdCd(emiStdCd);
		prdCarInfoVO.setMaxHp(maxHp);
		prdCarInfoVO.setCylArr(cylArr);
		prdCarInfoVO.setCylNum(cylNum);
		prdCarInfoVO.setGearsNum(gearsNum);
		prdCarInfoVO.setGrboxDesc(grboxDesc);
		prdCarInfoVO.setInlMdl(inlMdl);
		prdCarInfoVO.setBuyWayCd(buyWayCd);
		prdCarInfoVO.setDoorNum(doorNum);

		prdCarInfoVO.setPrdYr(prdYr);
		prdCarInfoVO.setPrdCyCd(prdCyCd);
		prdCarInfoVO.setOutVol(outVol);
		prdCarInfoVO.setGrboxTypCd(grboxTypCd);
		prdCarInfoVO.setGrboxCfg(grboxCfg);
		prdCarInfoVO.setSeatQtyCd(seatQtyCd);
		prdCarInfoVO.setEngMdl(engMdl);
		prdCarInfoVO.setDrvTypCd(drvTypCd);
		prdCarInfoVO.setCarStrcCd(carStrcCd);
		prdCarInfoVO.setCarStrcCfg(carStrcCfg);
		prdCarInfoVO.setPowerTypCd(powerTypCd);
		prdCarInfoVO.setCarCl(carCl);
		if (StringUtils.isNotEmpty(carLen)) {
			prdCarInfoVO.setCarLen(Double.valueOf(carLen));
		}
		if (StringUtils.isNotEmpty(maxSpd)) {
			prdCarInfoVO.setMaxSpd(maxSpd);
		}
		prdCarInfoVO.setPrdWayCd(prdWayCd);
		prdCarInfoVO.setCarMdl(carMdl);
		prdCarInfoVO.setOthCfg(othCfg);
		prdCarInfoVO.setCrtTm(new Date());
		prdCarInfoVO.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
		return prdCarInfoVO;
	}

	// 项目基础信息
	private PrjPrdBscInfoVO getPrdBscInfoRequestParams(HttpServletRequest request)throws BaseException {
		PrjPrdBscInfoVO prdBscInfoVO = new PrjPrdBscInfoVO();
		List<PrjSplBankAccRVO> bankAccList = new ArrayList<PrjSplBankAccRVO>();
		String prdTypCd = request.getParameter("prdTypCd");// 产品类型
		String mfrId = request.getParameter("mfrId");// 厂商ID
		String mfrNm = request.getParameter("mfrNm");// 厂商名称
		String brCd = request.getParameter("brCd");// 品牌代码
		String prdNm = request.getParameter("prdNm");// 产品名称
		String prdMdl = request.getParameter("prdMdl");// 产品型号
		String guidePc = request.getParameter("guidePc");// 产品指导价
		String prdRem = request.getParameter("prdRem");// 备注
		String prdCd = request.getParameter("prdCd");// 产品代码
		String prjId = request.getParameter("prjId");// 项目id
		String prdId = request.getParameter("prdId");// 产品Id；
		String isNew = request.getParameter("isNew");// 是否为新品
		String usedPd = request.getParameter("usedPd");// 使用期限
		String secUsedPd = request.getParameter("secUsedPd");// 产品已使用期限
		String rsrvPc = request.getParameter("rsrvPc");// 产品留购价
		String prdQty = request.getParameter("prdQty");// 产品数量
		// String prdUntCd = request.getParameter("prdUntCd");//计量单位
		String prdAmt = request.getParameter("prdAmt");// 产品金额
		String splId = request.getParameter("splId");// 供应商ID
		String splNm = request.getParameter("splNm");// 供应商名称
		String certDt = request.getParameter("certDt");// 登记证书日期
		String invAmt = request.getParameter("invAmt");// 发票金额(元)
		String irrPct = request.getParameter("irrPct");// 实际收益
		String prdDtlId = request.getParameter("prdDtlId");// 产品详细ID
		String removeFlag = request.getParameter("removeFlag");// 是否删除支付表、产品明细等信息
		String deprRate = request.getParameter("deprRate");// 折旧率
		String deprAmt = request.getParameter("deprAmt");// 折旧金额
		String splAccNoId = request.getParameter("splAccNoId");// 供应商账号
		String bankAccNoList = request.getParameter("bankAccNoList");
		String splMfrId  = request.getParameter("splMfrId");
		String splMfrNm  = request.getParameter("splMfrNm");
		String mOthInfo = request.getParameter("mOthInfo");
		String  licenseCd = request.getParameter("licenseCd");

		PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
		if(prjBscInfoVO.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK)
				&&((prjBscInfoVO.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_CPYW) && (prjBscInfoVO.getIsSplMfr() == 1L)) || (prjBscInfoVO.getPrjTypCd().equals(PrjBscInfoConstant.PRJ_TYP_CD_CTYW) && (prjBscInfoVO.getIsSplMfr() == 1L)))
				&&StringUtils.isBlank(splMfrId)
		){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"请选择供应商厂商信息");
		}
	/*	if(prjBscInfoVO.getBuOrgCd().equals(PrjBscInfoConstant.CODE_BU_ORG_CD_ZK)
				&&(null!=prjBscInfoVO.getInsCode()&&prjBscInfoVO.getInsCode().equals(PrjBscInfoConstant.PRJ_INS_CODE_ICBC))
				&&StringUtils.isBlank(mOthInfo)
				){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"请按照要求填写备注信息！");
		}*/
		if(StringUtils.isNotBlank(licenseCd)){
			prdBscInfoVO.setLicenseCd(licenseCd);
		}
		if(StringUtils.isNotBlank(splMfrId)){
			prdBscInfoVO.setSplMfrId(Long.valueOf(splMfrId));
		}
		if(StringUtils.isNotBlank(splMfrNm)){
			prdBscInfoVO.setSplMfrNm(splMfrNm);
		}
		if (StringUtils.isNotBlank(splAccNoId)) {
			prdBscInfoVO.setSplAccNoId(Long.valueOf(splAccNoId));
		}
		if (StringUtils.isNotBlank(deprRate)) {
			prdBscInfoVO.setDeprRate(Double.valueOf(deprRate));
		}
		if (StringUtils.isNotBlank(deprAmt)) {
			prdBscInfoVO.setDeprAmt(Double.valueOf(deprAmt));
		}
		if (StringUtils.isNotBlank(irrPct)) {
			prdBscInfoVO.setIrrPct(Double.valueOf(irrPct));
		}
		if (StringUtils.isNotBlank(certDt)) {
			prdBscInfoVO.setCertDt(DateUtils.formatStringToDate(certDt,
					DateUtils.YYYY_MM_DD));
		}
		List<PrjSplBankAccRVO> list = new ArrayList<PrjSplBankAccRVO>();
		if(StringUtils.isNotBlank(bankAccNoList)){
			bankAccList = JSON.parseArray(bankAccNoList, PrjSplBankAccRVO.class);
			for (PrjSplBankAccRVO prjSplBankAccRVO : bankAccList) {
				if(null!=prjSplBankAccRVO.getSplAccNoId()){
					list.add(prjSplBankAccRVO);
				}
			}
		}
		prdBscInfoVO.setPrjSplBankAccRVOList(list);
		if (StringUtils.isNotBlank(invAmt)) {
			prdBscInfoVO
					.setInvAmt(DecimalUtils.mul(Double.valueOf(invAmt), 100));
		}
		prdBscInfoVO.setRemoveFlag(removeFlag);
		prdBscInfoVO.setPrdTypCd(prdTypCd);
		if (StringUtils.isNotEmpty(mfrId)) {
			prdBscInfoVO.setMfrId(Long.valueOf(mfrId));
		}
		prdBscInfoVO.setMfrNm(mfrNm);
		prdBscInfoVO.setBrCd(brCd);

		if (StringUtils.isNotEmpty(prdDtlId)) {
			prdBscInfoVO.setPrdDtlId(Long.valueOf(prdDtlId));
		}
		if (StringUtils.isNotEmpty(prjId)) {
			prdBscInfoVO.setPrjId(Long.valueOf(prjId));
		}
		if (StringUtils.isNotEmpty(prdId)) {
			prdBscInfoVO.setPrdId(Long.valueOf(prdId));
		}
		if (StringUtils.isNotEmpty(isNew)) {
			prdBscInfoVO.setIsNew(Integer.parseInt(isNew));
		}
		if (StringUtils.isNotEmpty(usedPd)) {
			prdBscInfoVO.setUsedPd(Integer.valueOf(usedPd));
		} else {
			if (StringUtils.isNotEmpty(secUsedPd)) {
				prdBscInfoVO.setUsedPd(Integer.valueOf(secUsedPd));
			}
		}
		if (StringUtils.isNotEmpty(rsrvPc)) {
			prdBscInfoVO.setRsrvPc(DecimalUtils.mul(Long.valueOf(rsrvPc), 100));
		}
		if (StringUtils.isNotEmpty(prdQty)) {
			prdBscInfoVO.setPrdQty(Integer.parseInt(prdQty));
			if(prdBscInfoVO.getPrdQty()>PrjPrdBscInfoConstant.PRJ_PRD_MAX_QTY){
				throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"产品的数量最多为："+PrjPrdBscInfoConstant.PRJ_PRD_MAX_QTY);
			}
		}
		/*
		 * if(StringUtils.isNotEmpty(prdUntCd)){
		 * prdBscInfoVO.setPrdUntCd(prdUntCd); }
		 */
		if (StringUtils.isNotEmpty(guidePc)) {
			prdBscInfoVO.setGuidePc(DecimalUtils.mul(Double.valueOf(guidePc),
					100));
		}
		if (StringUtils.isNotEmpty(guidePc) && StringUtils.isNotEmpty(prdQty)) {
			prdBscInfoVO.setPrdAmt(DecimalUtils.mul(prdBscInfoVO.getGuidePc(),
					Double.valueOf(prdQty)));
		}
		if (StringUtils.isNotEmpty(splId)) {
			prdBscInfoVO.setSplId(Long.parseLong(splId));
		}

		prdBscInfoVO.setSplNm(splNm);
		prdBscInfoVO.setPrdNm(prdNm.trim());
		if(StringUtils.isNotBlank(prdMdl)){
			prdBscInfoVO.setPrdMdl(prdMdl.trim());
		}

		prdBscInfoVO.setPrdRem(prdRem);
		prdBscInfoVO.setPrdCd(prdCd);
		prdBscInfoVO.setPrdTypCd(prdTypCd);
		return prdBscInfoVO;
	}

	/**
	 * 修改
	 */
	@RequestMapping(value = "/modify.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modify(HttpServletRequest request,
						 HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"修改成功!");
		if (StringUtils.isEmpty(id)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("参数不完整！");
			return result;
		}
		try {
            PrjBscInfoVO entity = new PrjBscInfoVO();
            entity.setId(Long.valueOf(id));
            // entity.setName(name);
            boolean success = false;// this.prjBscInfoService.modify(entity);
			if (!success) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("修改失败！");
			}
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("修改失败!msg:{}", ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("修改失败!");
			logger.error("修改失败!msg:{}", ex.getMessage());
		}
		return result;
	}

	/**
	 * 启动流程
	 */
	@RequestMapping(value = "/addFlowStart.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addFlowStart(HttpServletRequest request,
							   HttpServletResponse response) {
		String id = request.getParameter("id");// 业务数据ID
		String procDefKey = request.getParameter("procDefKey");
		String procDefId = request.getParameter("procDefId");
		String procNo = request.getParameter("procNo");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				SysLogConstant.LOG_CMM_OPERATE_SUCC);
		if (StringUtils.isEmpty(id)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
			logger.info("addFlowStart:{},操作人:{}",SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY,CurrentThreadContext.getCurrentUserName());
			return result;
		}
		FlowStartParamsDTO flowStartParamsDTO = new FlowStartParamsDTO();
		try {
			// 流程定义Key和流程定义ID 如果是前端选择的则直接指定,如果不是则系统自动按照配置选择唯一一条记录,如果找不到会提示
			flowStartParamsDTO.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_IN);
			flowStartParamsDTO
					.setWordsInTheTable(PrjBscInfoConstant.PRJ_FLOW_S_H_PRJ);
			flowStartParamsDTO.setProcDefKey(procDefKey);
			flowStartParamsDTO.setProcDefId(procDefId);
			flowStartParamsDTO.setProcNo(procNo);
			flowStartParamsDTO.setCrtUsrId(CurrentThreadContext
					.getCurrentUserId());
			flowStartParamsDTO.setBusinessKey(id);
			flowStartParamsDTO.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
			flowStartParamsDTO.setSysCd(CurrentThreadContext.getCurrentSysCd());
			flowStartParamsDTO.setBuOrgCd(CurrentThreadContext
					.getCurrentBuOrgCd());
			flowStartParamsDTO.setInitiator(String.valueOf(CurrentThreadContext
					.getCurrentUserId()));
			flowStartParamsDTO.setInitiatorNm(CurrentThreadContext
					.getCurrentUserName());
			flowStartParamsDTO
					.setProcPriority(FlowConstant.FLOW_PRIORITY_EMERGENCY);// 优先级,可以在界面定义
			flowStartParamsDTO
					.setBusinessType(FlowConstant.FLOW_BUSINESS_TYP_PRJ_BSC_INFO);// TODO
			// 确认用不用
			flowStartParamsDTO.setModelTyp(FlowConstant.FLOW_MODEL_TYP_PRJ_1);// 需要和流程配置中的模块类型匹配
			// flowStartParamsDTO.setSearchDesc(CurrentThreadContext.getCurrentOrgDispNm()+"、承租人、项目名称、查询大字段名称");
			// flowStartParamsDTO.setOrgShtNm(CurrentThreadContext.getCurrentOrgShtNm());
			DataResultDTO dataResultDTO = this.prjBscInfoService
					.addFlowStart(flowStartParamsDTO);
			if (!dataResultDTO.getCode().equals(
					BaseExceptionConstant.BASE_EXCEPTION_CODE_200)) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo(SysLogConstant.LOG_CMM_OPERATE_FAIL);
			}
			if (null != dataResultDTO && null != dataResultDTO.getData()) {
//				FlowStartedDTO flowStartedDTO = (FlowStartedDTO) dataResultDTO
//						.getData();
                String data = JSON.toJSONString(dataResultDTO.getData());
                JSONObject jsonObject = JSON.parseObject(data);
                FlowStartedDTO flowStartedDTO = JSONObject.toJavaObject(jsonObject, FlowStartedDTO.class);
				if (StringUtils
						.isNotBlank(flowStartedDTO.getNextOperUsrNames())) {
					result.setInfo("下一个节点操作人:"
							+ flowStartedDTO.getNextOperUsrNames());
				} else {
					result.setInfo("流程发起成功");
				}
			}
			/*
			 * if(null != dataResultDTO.getInfo() &&
			 * StringUtils.isNotEmpty(dataResultDTO.getInfo())){ StringBuffer
			 * info = new StringBuffer(); info.append(result.getInfo());
			 * info.append(SysLogConstant.LOG_FLOW_NEXT_TASK_OPERATOR);
			 * info.append(dataResultDTO.getInfo());//操作人
			 * result.setInfo(info.toString()); }
			 */
		} catch (BaseException e) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(e.getMessage());
			logger.error("流程发起失败！msg:{}",e.getMessage());
		} catch (Exception e) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("系统错误,请联系管理员！");
			logger.error("系统错误,请联系管理员！msg:{}",e.getMessage());
		}
		return result;
	}

	/**
	 * **************************项目相关资料**************************
	 */
	/**
	 * 项目相关资料
	 */
	@RequestMapping(value = "/initPrjFileList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initPrjFileList(HttpServletRequest request,
								  HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prjId = request.getParameter("prjId");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		// 查询项目的事业部
		PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long
				.valueOf(prjId));
		if (null != prjBsc) {
			orgCd = prjBsc.getBuOrgCd();
		}
		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		List<String> codeList = new ArrayList<String>();
		codeList.add(PrjBscInfoConstant.CODE_PRJ_FILE_CD);
		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		qc.setCfgCdList(codeList);
		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		SysUlDatCfgVO cfg = null;
		if (CollectionUtils.isNotEmpty(list)) {
			cfg = list.get(0);
		}
		List<SysUlDatCfgDtlVO> dtlList = cfg.getSysUlDatCfgDtlVOList();
		SysUlFilesRecQueryCondition ulFileQc = new SysUlFilesRecQueryCondition();
		ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
		ulFileQc.setSysCd(qc.getSysCd());
		ulFileQc.setOrgCd(orgCd);
		ulFileQc.setPkId(prjId);
		List<SysUlFilesRecVO> fileList = sysUlFilesRecService
				.searchList(ulFileQc);
		if (CollectionUtils.isNotEmpty(dtlList)) {
			for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : dtlList) {
				if (CollectionUtils.isNotEmpty(fileList)) {
					for (SysUlFilesRecVO sysUlFilesRecVO : fileList) {
						if (sysUlDatCfgDtlVO.getCfgDtlCd().equals(
								sysUlFilesRecVO.getCfgDtlCd())
								&& sysUlDatCfgDtlVO.getCfgCd().equals(
								sysUlFilesRecVO.getCfgCd())) {
							sysUlDatCfgDtlVO.setFileRec(sysUlFilesRecVO);
							break;
						}
					}
				}
			}
		}

		ListPageVO<SysUlDatCfgDtlVO> listPage = new ListPageVO<SysUlDatCfgDtlVO>(
				dtlList, dtlList.size());
		return listPage;
	}

	/**
	 * 客户相关资料
	 */
	@RequestMapping(value = "/initCstFileList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initCstFileList(HttpServletRequest request,
								  HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prjId = request.getParameter("prjId");
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		CstBscInfoVO cstBscInfoVO = null;
		String cstType = "";
		Long cstId = null;
		if (StringUtils.isNotBlank(prjId)) {
			cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
					.valueOf(prjId));
			if (null != cstBscInfoVO) {
				cstType = cstBscInfoVO.getCstTypCd();
				cstId = cstBscInfoVO.getId();
			}
		}
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		// 查询项目的事业部
		PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long
				.valueOf(prjId));
		if (null != prjBsc) {
			orgCd = prjBsc.getBuOrgCd();
		}
		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		// 查承租人照片配置信息
		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjCstBscInfoConstant.CODE_CST_FILE_NP_CD);
			qc.setCfgCdList(codeList);
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjCstBscInfoConstant.CODE_CST_FILE_CORP_CD);
			qc.setCfgCdList(codeList);
		}
		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		SysUlDatCfgVO cfg = null;
		if (CollectionUtils.isNotEmpty(list)) {
			cfg = list.get(0);
		}
		List<SysUlDatCfgDtlVO> dtlList = cfg.getSysUlDatCfgDtlVOList();
		SysUlFilesRecQueryCondition ulFileQc = new SysUlFilesRecQueryCondition();
		ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
		ulFileQc.setSysCd(qc.getSysCd());
		ulFileQc.setOrgCd(orgCd);
		ulFileQc.setPkId(cstId.toString());
		List<SysUlFilesRecVO> fileList = sysUlFilesRecService
				.searchList(ulFileQc);
		if (CollectionUtils.isNotEmpty(dtlList)) {
			for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : dtlList) {
				if (CollectionUtils.isNotEmpty(fileList)) {
					for (SysUlFilesRecVO sysUlFilesRecVO : fileList) {
						if (sysUlDatCfgDtlVO.getCfgDtlCd().equals(
								sysUlFilesRecVO.getCfgDtlCd())
								&& sysUlDatCfgDtlVO.getCfgCd().equals(
								sysUlFilesRecVO.getCfgCd())) {
							sysUlDatCfgDtlVO.setFileRec(sysUlFilesRecVO);
							break;
						}
					}
				}
			}
		}

		ListPageVO<SysUlDatCfgDtlVO> listPage = new ListPageVO<SysUlDatCfgDtlVO>(
				dtlList, dtlList.size());
		return listPage;
	}

	/**
	 * 租赁物相关资料
	 */
	@RequestMapping(value = "/initPrjPrdFileList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initPrjPrdFileList(HttpServletRequest request,
									 HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String dtlId = request.getParameter("dtlId");// 项目产品明细ID
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		// 查询项目的事业部
		PrjPrdDtlVO dtl = this.prjPrdDtlService.selectById(Long.valueOf(dtlId));
		if (null != dtl) {
			PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(dtl
					.getPrjId());
			if (null != prjBsc) {
				orgCd = prjBsc.getBuOrgCd();
			}
		}
		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		List<String> codeList = new ArrayList<String>();
		codeList.add(PrjBscInfoConstant.CODE_PRJ_PRD_FILE_CD);
		qc.setCfgCdList(codeList);
		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setCfgCdList(codeList);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		SysUlDatCfgVO cfg = null;

		if (CollectionUtils.isNotEmpty(list)) {
			cfg = list.get(0);
		}
		List<SysUlDatCfgDtlVO> dtlList = cfg.getSysUlDatCfgDtlVOList();
		SysUlFilesRecQueryCondition ulFileQc = new SysUlFilesRecQueryCondition();
		ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
		ulFileQc.setSysCd(qc.getSysCd());
		ulFileQc.setOrgCd(orgCd);
		ulFileQc.setPkId(dtlId);
		List<SysUlFilesRecVO> fileList = sysUlFilesRecService
				.searchList(ulFileQc);
		if (CollectionUtils.isNotEmpty(dtlList)) {
			for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : dtlList) {
				if (CollectionUtils.isNotEmpty(fileList)) {
					for (SysUlFilesRecVO sysUlFilesRecVO : fileList) {
						if (sysUlDatCfgDtlVO.getCfgDtlCd().equals(
								sysUlFilesRecVO.getCfgDtlCd())
								&& sysUlDatCfgDtlVO.getCfgCd().equals(
								sysUlFilesRecVO.getCfgCd())) {
							sysUlDatCfgDtlVO.setFileRec(sysUlFilesRecVO);
							break;
						}
					}
				}
			}
		}
		ListPageVO<SysUlDatCfgDtlVO> listPage = new ListPageVO<SysUlDatCfgDtlVO>(
				dtlList, dtlList.size());
		return listPage;
	}

	/**
	 * 到项目附件页面
	 */
	@RequestMapping(value = "/toPrjFileInfoPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjFileInfoPage(HttpServletRequest request,
										  HttpServletResponse response) {
		String prjId = request.getParameter("prjId");// 项目ID
		String detailFlag = request.getParameter("detailFlag");// 是否详细
		Long cstId = null;
		if (StringUtils.isNotBlank(prjId)) {
			CstBscInfoVO cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
					.valueOf(prjId));
			if (null != cstBscInfoVO) {
				cstId = cstBscInfoVO.getId();
			}
		}
		logger.info("加载toPrjFileInfoPage页面.");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectPrjFileInfo");
		view.addObject("prjId", prjId);
		view.addObject("cstId", cstId);
		view.addObject("detailFlag", detailFlag);
		return view;
	}

	/**
	 * 到项目资料上传页面
	 */
	@RequestMapping(value = "/toUploadPrjFileInfoPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toUploadPrjFileInfoPage(HttpServletRequest request,
												HttpServletResponse response) {
		String prjId = request.getParameter("prjId");
		String detailFlag = request.getParameter("detailFlag");
		String sysCd = request.getParameter("sysCd");
		String orgCd = request.getParameter("orgCd");
		String cfgCd = request.getParameter("cfgCd");
		String cfgDtlCd = request.getParameter("cfgDtlCd");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectPrjFileInfoAdd");
		view.addObject("prjId", prjId);
		view.addObject("sysCd", sysCd);
		view.addObject("orgCd", orgCd);
		view.addObject("cfgCd", cfgCd);
		view.addObject("cfgDtlCd", cfgDtlCd);
		view.addObject("detailFlag", detailFlag);
		return view;
	}

	/**
	 * 到客户资料上传页面
	 */
	@RequestMapping(value = "/toUploadCstFileInfoPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toUploadCstFileInfoPage(HttpServletRequest request,
												HttpServletResponse response) {
		String prjId = request.getParameter("prjId");
		String cstId = request.getParameter("cstId");
		String detailFlag = request.getParameter("detailFlag");
		String sysCd = request.getParameter("sysCd");
		String orgCd = request.getParameter("orgCd");
		String cfgCd = request.getParameter("cfgCd");
		String cfgDtlCd = request.getParameter("cfgDtlCd");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectCstFileInfoAdd");
		view.addObject("prjId", prjId);
		view.addObject("sysCd", sysCd);
		view.addObject("orgCd", orgCd);
		view.addObject("cfgCd", cfgCd);
		view.addObject("cfgDtlCd", cfgDtlCd);
		view.addObject("detailFlag", detailFlag);
		view.addObject("cstId", cstId);
		return view;
	}

	/**
	 * 新增客户资料信息
	 */
	@RequestMapping(value = "/addCstFile.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addCstFile(HttpServletRequest request,
							 HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				SysLogConstant.LOG_CMM_ADD_SUCC);
		PrjLnkCompVO entity = null;
		String prjId = request.getParameter("prjId");
		String fileNm = request.getParameter("fileNm");
		String filePath = request.getParameter("filePath");
		String sysCd = request.getParameter("sysCd");
		String orgCd = request.getParameter("orgCd");
		String cfgCd = request.getParameter("cfgCd");
		String cfgDtlCd = request.getParameter("cfgDtlCd");
		String cstId = request.getParameter("cstId");

		Long id = null;
		try {
			SysUlFilesRecVO fileRec = new SysUlFilesRecVO();
			if (StringUtils.isNotBlank(cstId)) {
				fileRec.setPkId(cstId);
			}
			SysUlFilesRecQueryCondition fileQc = new SysUlFilesRecQueryCondition();
			fileQc.setCfgCd(cfgCd);
			fileQc.setPkId(cstId);
			fileQc.setTabNm("CST_BSC_INFO");
			fileQc.setOrgCd(orgCd);
			fileQc.setSysCd(sysCd);
			fileQc.setCfgDtlCd(cfgDtlCd);
			fileRec.setFileNm(fileNm);
			fileRec.setFilePath(filePath);
			fileRec.setSysCd(sysCd);
			fileRec.setOrgCd(orgCd);
			fileRec.setCfgCd(cfgCd);
			fileRec.setCfgDtlCd(cfgDtlCd);
			fileRec.setTabNm("CST_BSC_INFO");
			fileRec.setCrtTm(new Date());
			fileRec.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
			fileRec.setMdfTm(new Date());
			fileRec.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
			fileRec.setIsDel(BaseConstant.IS_YESNO_NO);
			fileRec.setAbsLocPath(PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_ROOT_PATH)+filePath);

			id = this.prjBscInfoService.addFileRec(fileQc, fileRec);
			logger.info("add,新增数据.id:{},entity:{},操作人:{}",id,JSONObject.toJSONString(entity),CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("新增数据失败.DATA:{},msg:{},操作人:{}",JSONObject.toJSONString(entity),ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			logger.error("新增数据失败.DATA:{},msg:{},操作人:{}",JSONObject.toJSONString(entity),ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 到项目产品资料上传页面
	 */
	@RequestMapping(value = "/toPrjPrdFileListPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjPrdFileListPage(HttpServletRequest request,
											 HttpServletResponse response) {
		String dtlId = request.getParameter("dtlId");
		String detailFlag = request.getParameter("detailFlag");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectPrjPrdFileInfoList");
		view.addObject("dtlId", dtlId);
		view.addObject("detailFlag", detailFlag);
		return view;
	}

	/**
	 * 到项目租赁物资料上传页面
	 */
	@RequestMapping(value = "/toUploadPrjPrdFileInfoPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toUploadPrjPrdFileInfoPage(HttpServletRequest request,
												   HttpServletResponse response) {
		String prjId = request.getParameter("prjId");
		String dtlId = request.getParameter("dtlId");
		String detailFlag = request.getParameter("detailFlag");
		String sysCd = request.getParameter("sysCd");
		String orgCd = request.getParameter("orgCd");
		String cfgCd = request.getParameter("cfgCd");
		String cfgDtlCd = request.getParameter("cfgDtlCd");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectPrjPrdFileInfoAdd");
		view.addObject("prjId", prjId);
		view.addObject("sysCd", sysCd);
		view.addObject("orgCd", orgCd);
		view.addObject("cfgCd", cfgCd);
		view.addObject("cfgDtlCd", cfgDtlCd);
		view.addObject("detailFlag", detailFlag);
		view.addObject("dtlId", dtlId);
		return view;
	}

	/**
	 * 新增客户资料信息
	 */
	@RequestMapping(value = "/addPrjPrdFile.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object addPrjPrdFile(HttpServletRequest request,
								HttpServletResponse response) throws BaseException {
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				SysLogConstant.LOG_CMM_ADD_SUCC);
		PrjLnkCompVO entity = null;
		String prjId = request.getParameter("prjId");
		String fileNm = request.getParameter("fileNm");
		String filePath = request.getParameter("filePath");
		String sysCd = request.getParameter("sysCd");
		String orgCd = request.getParameter("orgCd");
		String cfgCd = request.getParameter("cfgCd");
		String cfgDtlCd = request.getParameter("cfgDtlCd");
		String dtlId = request.getParameter("dtlId");

		Long id = null;
		try {
			SysUlFilesRecVO fileRec = new SysUlFilesRecVO();
			if (StringUtils.isNotBlank(dtlId)) {
				fileRec.setPkId(dtlId);
			}
			SysUlFilesRecQueryCondition fileQc = new SysUlFilesRecQueryCondition();
			fileQc.setCfgCd(cfgCd);
			fileQc.setPkId(dtlId);
			fileQc.setTabNm("PRJ_PRD_DTL");
			fileQc.setOrgCd(orgCd);
			fileQc.setSysCd(sysCd);
			fileQc.setCfgDtlCd(cfgDtlCd);
			fileRec.setFileNm(fileNm);
			fileRec.setFilePath(filePath);
			fileRec.setSysCd(sysCd);
			fileRec.setOrgCd(orgCd);
			fileRec.setCfgCd(cfgCd);
			fileRec.setCfgDtlCd(cfgDtlCd);
			fileRec.setTabNm("PRJ_PRD_DTL");
			fileRec.setCrtTm(new Date());
			fileRec.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
			fileRec.setMdfTm(new Date());
			fileRec.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
			fileRec.setIsDel(BaseConstant.IS_YESNO_NO);
			id = this.prjBscInfoService.addFileRec(fileQc, fileRec);
			logger.info("add,新增数据.id:{}, DATA:{},操作人:{}",id,JSONObject.toJSONString(entity),CurrentThreadContext.getCurrentUserName());
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("新增数据失败.DATA:{},msg:{}操作人:{}",JSONObject.toJSONString(entity),ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			logger.error("新增数据失败.DATA:{},操作人:{}",JSONObject.toJSONString(entity),ex.getMessage(),CurrentThreadContext.getCurrentUserName());
		}
		return result;
	}

	/**
	 * 到图片打开页面
	 */
	@RequestMapping(value = "/imgWinOpen.do", method = { RequestMethod.GET,
			RequestMethod.POST })
	public ModelAndView imgWinOpen(HttpServletRequest request,
								   HttpServletResponse response) {
		ModelAndView view = new ModelAndView("project/imgWinOpen");
		return view;
	}

	/**
	 * 删除的项目列表包括（流程中和审核通过的项目）
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initListForDelQuary.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initListForDelQuary(HttpServletRequest request,
									  HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prjNm = request.getParameter("prjNm");
		String cstNm = request.getParameter("cstNm");
		String prjTyCd = request.getParameter("prjTypCd");
		String bizTypCd = request.getParameter("bizTypCd");
		String buOrgCd = request.getParameter("buOrgCd");// 事业部
		String cstId = request.getParameter("cstId");// 客户ID
		String splId = request.getParameter("splId");// 供应商ID(YAOXIURONG)
		String lsCntNo = request.getParameter("lsCntNo");
		String lnkCompId = request.getParameter("lnkCompId");// 挂靠公司ID
		String cstMgrNm = request.getParameter("cstMgrNm");// 客户经理
		String cntTypCd = request.getParameter("cntTypCd");
		String isDel = request.getParameter("isDel");//是否删除
		String insCode = request.getParameter("insCode");//资管机构编码
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrjBscInfoQueryCondition qc = new PrjBscInfoQueryCondition();
		if (StringUtils.isNotBlank(buOrgCd)) {
			qc.setBuOrgCd(buOrgCd);
		}
		if (StringUtils.isNotBlank(lsCntNo)) {
			qc.setLsCntNo(lsCntNo);
		}
		if (StringUtils.isNotBlank(cntTypCd)) {
			qc.setCntTypCd(cntTypCd);
		}
		if (StringUtils.isNotBlank(cstMgrNm)) {
			qc.setCstMgrNm(cstMgrNm);
		}
		if (StringUtils.isNotBlank(lnkCompId)) {
			qc.setCompLnkId(Long.valueOf(lnkCompId));
		}
		if (StringUtils.isNotBlank(prjNm)) {
			qc.setPrjNm(prjNm);
		}
		if (StringUtils.isNotBlank(cstNm)) {
			qc.setCstNm(cstNm);
		}
		if (StringUtils.isNotBlank(prjTyCd)) {
			qc.setPrjTypCd(prjTyCd);
		}
		if (StringUtils.isNotBlank(bizTypCd)) {
			qc.setBizTypCd(bizTypCd);
		}
		if (StringUtils.isNotEmpty(cstId) && StringUtils.isNumeric(cstId)) {
			List<Long> cstIdList = new ArrayList<>();
			cstIdList.add(Long.valueOf(cstId));
			qc.setCstIdList(cstIdList);
		}
		if (StringUtils.isNotEmpty(splId) && StringUtils.isNumeric(splId)) {
			qc.setSplId(Long.valueOf(splId));// YAOXIURONG
		}
		if(StringUtils.isNotBlank(isDel)){
			qc.setIsDel(Integer.valueOf(isDel));
		}
		if (StringUtils.isNotEmpty(insCode)) {
			qc.setInsCode(insCode);
		}

//		List<String> prjStsCdList = new ArrayList<String>();
//		prjStsCdList.add(FlowConstant.FLOW_CHECK_STATE_IN);
//		prjStsCdList.add(FlowConstant.FLOW_CHECK_STATE_PASS);
//		prjStsCdList.add(FlowConstant.FLOW_CHECK_STATE_REJECT);
//		qc.setPrjStsCdList(prjStsCdList);
		qc.setUsrId(CurrentThreadContext.getCurrentUserId());
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		page.setCondition(qc);
		Pager pager = this.prjBscInfoService.searchListPage(page);
		List<PrjBscInfoVO> list = (List<PrjBscInfoVO>) pager.getResultList();
		ListPageVO<PrjBscInfoVO> listPage = new ListPageVO<PrjBscInfoVO>(list,
				pager.getTotalCount());
		return listPage;
	}
	/**
	 *
	 * 到删除项目查询列表页面
	 */
	@RequestMapping(value = "/toPrjBscInfoForDelQuaryListPage.do", method = { RequestMethod.GET })
	public ModelAndView toPrjBscInfoForDelQuaryListPage(HttpServletRequest request,
														HttpServletResponse response) {
		logger.info("加载PrjListPage列表页面.");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectPrjBscInfoDelQueryList");
		String queryFlag = request.getParameter("query");
		String lnkCompId = request.getParameter("lnkCompId");
		// 项目类型
		List<KeyValueVO> projectTypeList = this.prjBscInfoService
				.getPrjTypCdALLKV();
		// 业务类型
		List<KeyValueVO> bizTypeList = this.prjBscInfoService.getBizTypeList();
		// 项目状态
		List<KeyValueVO> prjStsList = this.prjBscInfoService.getPrjStsList();
		// 事业部
		List<KeyValueVO> orgList = this.cstBscInfoService
				.searchBusinessOrgList();
		// 合同签署方式
		List<KeyValueVO> cntTypCdList = this.prjBscInfoService
				.getCntTypCdList();
		//支持撤销资方授信的资管机构列表
		List<KeyValueVO> cancelInsCreditList = this.sysDictionaryApiService.getKvList("PRJ0220","11000","0000");
		List<String> cancelInsCodeCreditList ;
		logger.info("支持撤销资方授信的资管机构列表 cancelInsCreditList={}",JSON.toJSONString(cancelInsCreditList));
		if (CollectionUtils.isNotEmpty(cancelInsCreditList)) {
			cancelInsCodeCreditList = new ArrayList<>(cancelInsCreditList.size());
			for (KeyValueVO keyValueVO : cancelInsCreditList) {
				cancelInsCodeCreditList.add(keyValueVO.getKey());
			}
			logger.info("支持撤销资方授信的资管机构编码列表 cancelInsCodeCreditList={}",JSON.toJSONString(cancelInsCodeCreditList));
			view.addObject("cancelInsCodeCreditList", cancelInsCodeCreditList);
		}

		view.addObject("cancelInsCreditList", cancelInsCreditList);
		view.addObject("orgListList", orgList);
		view.addObject("projectTypeList", projectTypeList);
		view.addObject("cntTypCdList", cntTypCdList);
		view.addObject("bizTypeList", bizTypeList);
		view.addObject("prjStsList", prjStsList);
		view.addObject("queryFlag", queryFlag);// 查询列表隐藏操作按钮
		view.addObject("lnkCompId", lnkCompId);
		view.addObject("currentBuOrgCd",
				CurrentThreadContext.getCurrentBuOrgCd());
		return view;
	}

	/**
	 *
	 * 到项目查重列表页面
	 */
	@RequestMapping(value = "/toRePrjListPage.do", method = { RequestMethod.GET })
	public ModelAndView toRePrjListPage(HttpServletRequest request,
										HttpServletResponse response) {
		logger.info("加载rePrjBscInfo列表页面.");
		ModelAndView view = new ModelAndView("project/prjbscinfo/rePrjBscInfoList");
		String cstTypCd = request.getParameter("cstTypCd");
		String prjId = request.getParameter("prjId");
		String type = request.getParameter("type");//查重类型
		String value = request.getParameter("value");//查重内容
		if(StringUtils.isNotEmpty(type) && StringUtils.isNotEmpty(value)){
			if("reCstNm".equals(type)){
				view.addObject("reCstNm", value);
			}else if("reCertNo".equals(type)){
				view.addObject("reCertNo", value);
			}else if("reIdAddr".equals(type)){
				view.addObject("reIdAddr", value);
			}else if("reMp1".equals(type)){
				view.addObject("reMp1", value);
			}else if("reWorkPlc".equals(type)){
				view.addObject("reWorkPlc", value);
			}else if("rePostAddr".equals(type)){
				view.addObject("rePostAddr", value);
			}else if("reWorkAddr".equals(type)){
				view.addObject("reWorkAddr", value);
			}else if("vin".equals(type)){
				view.addObject("vinListStr",value);
			}

		}
		// 项目类型
		List<KeyValueVO> projectTypeList = this.prjBscInfoService
				.getProjectTypeList();
		// 业务类型
		List<KeyValueVO> bizTypeList = this.prjBscInfoService.getBizTypeList();
		// 项目状态
		List<KeyValueVO> prjStsList = this.prjBscInfoService.getPrjStsList();
		// 事业部
		List<KeyValueVO> orgList = this.cstBscInfoService
				.searchBusinessOrgList();
		// 合同签署方式
		List<KeyValueVO> cntTypCdList = this.prjBscInfoService
				.getCntTypCdList();
		view.addObject("orgListList", orgList);
		view.addObject("projectTypeList", projectTypeList);
		view.addObject("cntTypCdList", cntTypCdList);
		view.addObject("bizTypeList", bizTypeList);
		view.addObject("prjStsList", prjStsList);
		view.addObject("currentBuOrgCd",CurrentThreadContext.getCurrentBuOrgCd());
		view.addObject("type",type);
		view.addObject("value",value);
		view.addObject("cstTypCd",cstTypCd);
		view.addObject("prjId",prjId);
		return view;
	}

	/**
	 * 初始化列表(查重)
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/reInitList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object reInitList(HttpServletRequest request,
							 HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String reCstNm = request.getParameter("reCstNm");//客户名
		String reCertNo = request.getParameter("reCertNo");//身份证号
		String reIdAddr = request.getParameter("reIdAddr");//身份证地址
		String reMp1 = request.getParameter("reMp1");//电话
		String reWorkPlc = request.getParameter("reWorkPlc");//工作单位
		String rePostAddr = request.getParameter("rePostAddr");//通讯地址
		String reWorkAddr = request.getParameter("reWorkAddr");//单位地址
		String cstTypCd = request.getParameter("cstTypCd");
		String prjId = request.getParameter("prjId");
		String vinListStr = request.getParameter("vinListStr");//vin列表串

		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrjBscInfoQueryCondition qc = new PrjBscInfoQueryCondition();

		qc.setUsrId(CurrentThreadContext.getCurrentUserId());
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		if (StringUtils.isNotBlank(reCstNm)) {
			qc.setReCstNm(reCstNm);
		}
		if (StringUtils.isNotBlank(reCertNo)) {
			qc.setReCertNo(reCertNo);
		}
		if (StringUtils.isNotBlank(reIdAddr)) {
			qc.setReIdAddr(reIdAddr);
		}
		if (StringUtils.isNotBlank(reMp1)) {
			qc.setReMp1(reMp1);
		}
		if (StringUtils.isNotBlank(reWorkPlc)) {
			qc.setReWorkPlc(reWorkPlc);
		}
		if (StringUtils.isNotBlank(rePostAddr)) {
			qc.setRePostAddr(rePostAddr);
		}
		if (StringUtils.isNotBlank(reWorkAddr)) {
			qc.setReWorkAddr(reWorkAddr);
		}
		if(StringUtils.isNotBlank(prjId)){
			qc.setId(Long.valueOf(prjId));
		}
		if(StringUtils.isNotEmpty(vinListStr)){
			qc.setVinListStr(vinListStr);
		}

		qc.setPrjStsCd(FlowConstant.FLOW_CHECK_STATE_PASS);
		qc.setCstTypCd(cstTypCd);
		page.setCondition(qc);
		Pager pager = this.prjBscInfoService.searchReListPage(page);
		List<PrjBscInfoVO> list = (List<PrjBscInfoVO>) pager.getResultList();
		ListPageVO<PrjBscInfoVO> listPage = new ListPageVO<PrjBscInfoVO>(list,
				pager.getTotalCount());
		return listPage;
	}


	/**
	 * 根据条件查询所有项目的情况
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/getPrjPopuInfo.do", method = { RequestMethod.GET})
	@ResponseBody
	public Object getPrjPopuInfo(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String splId = request.getParameter("splId");
        String cstMgrId = request.getParameter("cstMgrId");
        String lnkCompId = request.getParameter("lnkCompId");
        String mfrId = request.getParameter("mfrId");
        String accId = request.getParameter("accId");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "获取成功");
        try {
            PrjBscInfoQueryCondition qc = new PrjBscInfoQueryCondition();
            if(StringUtils.isNotEmpty(splId)){
                qc.setSplId(Long.parseLong(splId));
            }
            if(StringUtils.isNotEmpty(cstMgrId)){
                qc.setCstMgrId(Long.parseLong(cstMgrId));
            }
            if(StringUtils.isNotEmpty(lnkCompId)){
                qc.setCompLnkId(Long.parseLong(lnkCompId));
            }
            // 实际租赁价值的和
            double actLsAmtSum = 0d;
            List<Long> prjIds = null;
            if(StringUtils.isNotEmpty(mfrId)){
                qc.setMfrId(Long.parseLong(mfrId));
                PrjPrdBscInfoQueryCondition prjPrdBscInfoQueryCondition = new PrjPrdBscInfoQueryCondition();
                prjPrdBscInfoQueryCondition.setSplMfrId(Long.parseLong(mfrId));
                logger.info("getPrjPopuInfo", "查询产品的条件 ： " + JSON.toJSONString(prjPrdBscInfoQueryCondition));
                // 获取该厂商下的所有项目产品
                List<PrjPrdBscInfoVO> prjPrdBscInfoVOList = prjPrdBscInfoService.searchList(prjPrdBscInfoQueryCondition);
                logger.info("getPrjPopuInfo查询产品的结果 ： " + JSON.toJSONString(prjPrdBscInfoVOList));
                if (CollectionUtils.isEmpty(prjPrdBscInfoVOList)) {
                    PrjPopuInfoDTO prjPopuInfoDTO = new PrjPopuInfoDTO();
                    prjPopuInfoDTO.setPrjNum(0);
                    prjPopuInfoDTO.setPrjSucNum(0);
                    prjPopuInfoDTO.setPayAmt(0L);
                    prjPopuInfoDTO.setOvdPct(0d);
                    Map<String,Object> m = new HashMap<String,Object>();
                    m.put("prjPopuInfo", prjPopuInfoDTO);
                    result.setData(m);
                    return result;
                }
                prjIds = new ArrayList<>();
                // 获取全部项目id
                for (PrjPrdBscInfoVO prjPrdBscInfoVO : prjPrdBscInfoVOList) {
                    if (!prjIds.contains(prjPrdBscInfoVO.getPrjId())) {
                        prjIds.add(prjPrdBscInfoVO.getPrjId());
                    }
                }
                CapPayInfoQueryCondition condition = new CapPayInfoQueryCondition();
                condition.setPrjIds(prjIds);
                List<CapPayInfoVO> capPayInfoVOList = capPayInfoService.searchList(condition);
                for (CapPayInfoVO capPayInfoVO : capPayInfoVOList) {
                    actLsAmtSum += capPayInfoVO.getPayAmt();
                }
            }
            // 获取产品ids
            List<Long> prdIds = new ArrayList<>();
            if(StringUtils.isNotEmpty(accId)) {
                PrjSplBankAccRQueryCondition prjSplBankAccRQueryCondition = new PrjSplBankAccRQueryCondition();
                prjSplBankAccRQueryCondition.setSplAccNoId(Long.parseLong(accId));
                List<PrjSplBankAccRVO> prjSplBankAccRVOList = prjSplBankAccRService.searchList(prjSplBankAccRQueryCondition);
                if (CollectionUtils.isEmpty(prjSplBankAccRVOList)) {
                    PrjPopuInfoDTO prjPopuInfoDTO = new PrjPopuInfoDTO();
                    prjPopuInfoDTO.setPrjNum(0);
                    prjPopuInfoDTO.setPrjSucNum(0);
                    prjPopuInfoDTO.setPayAmt(0L);
                    prjPopuInfoDTO.setOvdPct(0d);
                    Map<String,Object> m = new HashMap<String,Object>();
                    m.put("prjPopuInfo", prjPopuInfoDTO);
                    result.setData(m);
                    return result;
                }

                for (PrjSplBankAccRVO prjSplBankAccRVO : prjSplBankAccRVOList) {
                    if (!prdIds.contains(prjSplBankAccRVO.getPrjPrdId())) {
                        prdIds.add(prjSplBankAccRVO.getPrjPrdId());
                    }
                }
                qc.setPrdIds(prdIds);
                qc.setAccId(Long.parseLong(accId));
                PrjPrdBscInfoQueryCondition prjPrdBscInfoQueryCondition = new PrjPrdBscInfoQueryCondition();
                prjPrdBscInfoQueryCondition.setIdList(prdIds);
                // 获取该厂商下的所有项目产品
                List<PrjPrdBscInfoVO> prjPrdBscInfoVOList = prjPrdBscInfoService.searchList(prjPrdBscInfoQueryCondition);

                prjIds = new ArrayList<>();
                if (CollectionUtils.isEmpty(prjPrdBscInfoVOList)) {
                    PrjPopuInfoDTO prjPopuInfoDTO = new PrjPopuInfoDTO();
                    prjPopuInfoDTO.setPrjNum(0);
                    prjPopuInfoDTO.setPrjSucNum(0);
                    prjPopuInfoDTO.setPayAmt(0L);
                    prjPopuInfoDTO.setOvdPct(0d);
                    Map<String,Object> m = new HashMap<String,Object>();
                    m.put("prjPopuInfo", prjPopuInfoDTO);
                    result.setData(m);
                    return result;
                }
                // 获取全部项目id
                for (PrjPrdBscInfoVO prjPrdBscInfoVO : prjPrdBscInfoVOList) {
                    if (!prjIds.contains(prjPrdBscInfoVO.getPrjId())) {
                        prjIds.add(prjPrdBscInfoVO.getPrjId());
                    }
                }
                CapPayInfoQueryCondition condition = new CapPayInfoQueryCondition();
                condition.setPrjIds(prjIds);
                List<CapPayInfoVO> capPayInfoVOList = capPayInfoService.searchList(condition);
                for (CapPayInfoVO capPayInfoVO : capPayInfoVOList) {
                    actLsAmtSum += capPayInfoVO.getPayAmt();
                }
            }
            if (CollectionUtils.isNotEmpty(prjIds)) {
                qc.setIdList(prjIds);
            }
            logger.info("getPrjPopuInfo,查询条件qc:{},操作人:{}",JSON.toJSONString(qc), CurrentThreadContext.getCurrentUserName());
            qc.setPrjStsCd("2");
            PrjPopuInfoDTO prjPopuInfo = this.prjBscInfoService.getPrjPopuInfo(qc);
            if (StringUtils.isNotEmpty(mfrId) || StringUtils.isNotEmpty(accId)) {
                prjPopuInfo.setPayAmt((long) actLsAmtSum);
            }
            if(null != prjPopuInfo){
                Map<String,Object> m = new HashMap<String,Object>();
                m.put("prjPopuInfo", prjPopuInfo);
                result.setData(m);
            }
            logger.info("getPrjPopuInfo,获取数据.spl:{},或cstMgrId:{}或mfrId:{},数据:{},操作人:{}",splId,cstMgrId,mfrId,JSON.toJSONString(result.getData()), CurrentThreadContext.getCurrentUserName());
        }catch(BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
			logger.error("getPrjPopuInfo,获取数据.spl:{},或cstMgrId:{}或mfrId:{},msg:{},操作人:{}",splId,cstMgrId,mfrId,ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }catch(Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
			logger.error("getPrjPopuInfo,获取数据.spl:{},或cstMgrId:{}或mfrId:{},msg:{},操作人:{}",splId,cstMgrId,mfrId,ex.getMessage(), CurrentThreadContext.getCurrentUserName());
        }
        return result;
	}

	/**
	 * 查询客户征信信息
	 *
	 * @param request
	 * @return
	 * @throws Exception
	 */
	@RequestMapping(value = "/queryCstCreditiInvest.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object queryCstCreditiInvest(HttpServletRequest request,
										HttpServletResponse response) throws BaseException {
		String prjId = request.getParameter("prjId");//查询客户的征信信息
		String prjTypCd = request.getParameter("prjTypCd");//项目类型
		String cstId = request.getParameter("cstId");//客户ID
		String cstMgrOrgCd = request.getParameter("cstMgrOrgCd");//客户经理的组织机构
		String insCode = request.getParameter("insCode");//机构code
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,"获取成功");
		if (StringUtils.isEmpty(prjTypCd)||StringUtils.isEmpty(cstId)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("参数不完整！");
			return result;
		}
		boolean flag = false;
		try {
			String buOrgCd = "";
			if(StringUtils.isBlank(prjId)){
				buOrgCd = CurrentThreadContext.getCurrentBuOrgCd();
				if (StringUtils.isEmpty(cstMgrOrgCd)){
					cstMgrOrgCd = CurrentThreadContext.getCurrentOrgCd() ;
				}
			}else{
				PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
				buOrgCd = prjBscInfoVO.getBuOrgCd();
				cstMgrOrgCd = prjBscInfoVO.getCstMgrOrgCd();
				if(!cstId.equals(prjBscInfoVO.getCstId().toString())||(!prjTypCd.equals(prjBscInfoVO.getPrjTypCd()))){
					flag = true;
				}
			}
			PrjCheckResultDTO checkResultDTO =  prjBscInfoService.searchRcCstBscInfoList(buOrgCd, prjTypCd, Long.valueOf(cstId),cstMgrOrgCd,StringUtils.isBlank(prjId)?null:Long.valueOf(prjId),flag,insCode);
			logger.info("查询前置征信信息：checkResultDTO:{}",JSON.toJSONString(checkResultDTO));
            //根据资方是否提供服务对客户征信结果资方信息进行筛选
            //这里后面可以做成可配置的
            boolean filterFlag = true;
            checkResultDTO = prjBscInfoService.getFilterRiskResultByIsService(checkResultDTO,filterFlag);
            String checkRes = BaseConstant.IS_YESNO_NO_STR;
            if(checkResultDTO != null && PrjBscInfoConstant.CODE_BU_ORG_CD_ZK.equals(buOrgCd) && (PrjBscInfoConstant.PRJ_TYP_CD_CTYW.equals(prjTypCd) || PrjBscInfoConstant.PRJ_TYP_CD_CPYW.equals(prjTypCd))){
				Map<String, Object> rcCstBscInfoMap = checkResultDTO.getRcCstBscInfoMap();
				if(MapUtils.isNotEmpty(rcCstBscInfoMap)){
					com.alibaba.fastjson.JSONArray rcCstBscInfoList = (com.alibaba.fastjson.JSONArray)rcCstBscInfoMap.get("rcCstBscInfoList");
					if(CollectionUtils.isNotEmpty(rcCstBscInfoList)){
						for (Object object : rcCstBscInfoList) {
							com.alibaba.fastjson.JSONObject rcCstBscInfoDTO = (com.alibaba.fastjson.JSONObject) object;
							Long splId = rcCstBscInfoDTO.getLong("splId");
							String rskLvlCd = rcCstBscInfoDTO.getString("rskLvlCd");
							if(StringUtils.isNotEmpty(splId) && !("3".equals(rskLvlCd))){
								Map<String,String> specialBusiness = this.iSplPropInfoApiService.getSpePowMapBySplId(splId,CurrentThreadContext.getCurrentSysCd(),cstMgrOrgCd);
								logger.info("查询客户征信信息.根据经销商id查询特殊业务列表信息specialBusiness:{}", JSON.toJSONString(specialBusiness) + "-cstId" + cstId);
								if(MapUtils.isNotEmpty(specialBusiness)){
									if(specialBusiness.containsKey(PrjQuatPrpsConstant.SPECIAL_BUSINESS_TYPE_7)){
										checkRes = BaseConstant.IS_YESNO_YES_STR;
										break;
									}
								}
							}
						}
					}
				}
			}
			result.setSignature(checkRes);//是否可以大客户
			result.setData(checkResultDTO);
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			ex.printStackTrace();
			logger.error("获取数据失败！msg:{}",ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("获取数据失败！");
			ex.printStackTrace();
			logger.error("获取数据失败！msg:{}",ex.getMessage());
		}
		logger.info("查询客户征信信息.返回结果result:{}", JSON.toJSONString(result) + "-cstId" + cstId);
		return result;
	}

	/*
	 *//**
	 * 到添加页面
	 *//*
	@RequestMapping(value = "/toMfrPrjBscInfoDetailPage.do", method = { RequestMethod.GET,
			RequestMethod.POST })
	public ModelAndView toMfrPrjBscInfoDetailPage(HttpServletRequest request,
			HttpServletResponse response) {
		logger.info("加载toMfrPrjBscInfoDetailPage add页面.");
		String prjId = request.getParameter("id");
		PrjBscInfoVO  prjBscInfoVO =  this.prjBscInfoService.selectMfrPrjBscInfoDetai(Long.valueOf(prjId));
		//查询项目客户信息
	//	CstBscInfoVO  cstBscInfoVO = this.cstBscInfoService.selectById(prjBscInfoVO.getCstId());
		ModelAndView view = new ModelAndView("project/prjbscinfo/projectPrjBscInfoMfrDetail");
		view.addObject("prjBscInfo", prjBscInfoVO);
	//	view.addObject("cstBscInfo", cstBscInfoVO);
		return view;
	}
	*//**
	 *
	 * 到厂商项目列表页面
	 *//*
	@RequestMapping(value = "/toMfrPrjBscInfoListPage.do", method = { RequestMethod.GET })
	public ModelAndView toMfrPrjBscInfoListPage(HttpServletRequest request,
			HttpServletResponse response) {
		logger.info("加载PrjBscInfo列表页面.");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectPrjBscInfoMfrList");
		return view;
	}

	*//**
	 * 初始化列表
	 *//*
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initMfrPrjBscInfoList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initMfrPrjBscInfoList(HttpServletRequest request,
			HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrjBscInfoQueryCondition qc = new PrjBscInfoQueryCondition();
		qc.setUsrId(CurrentThreadContext.getCurrentUserId());
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		qc.setIsDel(BaseConstant.IS_YESNO_NO);
		page.setCondition(qc);
		Pager pager = this.prjBscInfoService.searchMfrListPage(page);
		List<PrjBscInfoVO> list = (List<PrjBscInfoVO>) pager.getResultList();
		ListPageVO<PrjBscInfoVO> listPage = new ListPageVO<PrjBscInfoVO>(list,
				pager.getTotalCount());
		return listPage;
	}*/

	/**
	 * 解析excel,并进行业务及流程移交
	 */
	@RequestMapping(value = "/ywchange.do", method = { RequestMethod.POST })
	@ResponseBody
	public DataResultVO ywchange(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		Long startTm = System.currentTimeMillis();
		logger.info("ywchange,业务及流程移交开始时间：{}请求参数：{}",startTm,this.getRequestParameter(request));
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, SysLogConstant.LOG_CMM_OPERATE_SUCC);
		String filePath = request.getParameter("filePath");
		if(StringUtils.isEmpty(filePath)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("解析文件错误");
			logger.info("ywchange,操作数据,解析文件路径为空!user:{}", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		try {
			//同时支持Excel 2003、2007
			File excelFile=new File(PropertiesCacheUtils.getProperty(SysUlFilesRecConstant.SYS_FILE_UPLOAD_ROOT_PATH)+filePath);//创建文件对象
			FileInputStream is = new FileInputStream(excelFile); //文件流
			Workbook workbook = WorkbookFactory.create(is); //这种方式 Excel 2003/2007/2010 都是可以处理的
			Sheet sheet = workbook.getSheetAt(0);
			int rowCount = sheet.getPhysicalNumberOfRows(); //获取总行数
			List<PrjBscInfoVO> list = new ArrayList<PrjBscInfoVO>();//发送给流程接口数据集合
			JSONArray errorArr = new JSONArray();//未发送给流程接口数据集合
			JSONArray allArr = new JSONArray();//所有数据集合
			HashMap<String, SysUsrDTO> hcMap = new HashMap<String, SysUsrDTO>();//由于重复性操作较多  map存储临时数据（key：工号  val：用户对象）
			HashMap<String, String> orgCdMap = new HashMap<String, String>();//由于重复性操作较多  map存储临时数据（key：工号  val：组织架构）
			for (int r = 1; r < rowCount; r++) { // 从第2行开始
				Row row = sheet.getRow(r);
				PrjBscInfoVO _vo = new PrjBscInfoVO();
				net.sf.json.JSONObject obj = new net.sf.json.JSONObject();
				for(int z=0;z<3;z++) {//只有前三列有效
					Cell cell = row.getCell(z);
					String cellValue = "";
					if(z<2){
						if(cell==null||StringUtils.isBlank(cell.getStringCellValue())){
							result.setSuccess(BaseConstant.IS_YESNO_NO);
							result.setInfo("模板数据格式有误，请核实！");
							return result;
						}
						cellValue = cell.getStringCellValue().trim();
					}else{
						if(cell!=null&&StringUtils.isNotBlank(cell.getStringCellValue())){
							cellValue = cell.getStringCellValue().trim();
						}
					}
					switch (z){
						case 0://合同号
							logger.info("ywchange合同号验证:{}",cellValue);
							//查询项目ID
							PrjBscInfoQueryCondition qc = new PrjBscInfoQueryCondition();
							qc.setCntNo(cellValue);
							List<PrjBscInfoVO> prjBscInfoVOList = this.prjBscInfoService.searchPrjBscInfoList(qc);
							if(CollectionUtils.isNotEmpty(prjBscInfoVOList)&&prjBscInfoVOList.size()==1){
								PrjBscInfoVO prjBscInfoVO = prjBscInfoVOList.get(0);
								_vo.setId(prjBscInfoVO.getId());//项目ID
								_vo.setLsCntNo(prjBscInfoVO.getLsCntNo());//合同号
								_vo.setOriCstMgrId(prjBscInfoVO.getCstMgrId());//原客户经理ID
							}else{
								obj.put("lsCntNoMark", 0);
							}
							obj.put("lsCntNo", cellValue);
							break;
						case 1://转接人用户名
							logger.info("ywchange,转接人用户名验证：",cellValue);
							if(StringUtils.isNotEmpty(_vo.getId())){
								//查询用户ID及名称
								if(hcMap.containsKey(cellValue)){
									SysUsrDTO sysUsr = hcMap.get(cellValue);
									if(sysUsr!=null){
										_vo.setCstMgrId(sysUsr.getId());
										_vo.setCstMgrNm(sysUsr.getRefRlNm());
										_vo.setUsrNm(sysUsr.getUsrNm());
									}else{
										obj.put("usrNmMark", 0);
									}
								}else{
									SysUsrQueryCondition condition = new SysUsrQueryCondition();
									condition.setUsrNm(cellValue);
									condition.setSysCd(CurrentThreadContext.getCurrentSysCd());
									List<SysUsrDTO> sysUsrDTOs = this.sysUsrService.searchSysUsrList(condition);
									if(CollectionUtils.isNotEmpty(sysUsrDTOs)&&sysUsrDTOs.size()==1){
										SysUsrDTO sysUsrDTO = sysUsrDTOs.get(0);
										_vo.setCstMgrId(sysUsrDTO.getId());
										_vo.setCstMgrNm(sysUsrDTO.getRefRlNm());
										_vo.setUsrNm(sysUsrDTO.getUsrNm());
										hcMap.put(cellValue, sysUsrDTO);
									}else{
										hcMap.put(cellValue, null);
										obj.put("usrNmMark", 0);
									}
								}
							}else{
								obj.put("usrNmMark", 0);
							}
							obj.put("usrNm", cellValue);
							break;
						case 2://组织架构代码
							logger.info("ywchange,组织架构代码验证：{}",cellValue);
							if(StringUtils.isNotEmpty(_vo.getId())
									&& StringUtils.isNotEmpty(_vo.getCstMgrId())
									&& StringUtils.isNotBlank(_vo.getCstMgrNm())){
								if(orgCdMap.containsKey(obj.get("usrNm").toString())){
									if(orgCdMap.get(obj.get("usrNm").toString())!=null){
										_vo.setCstMgrOrgCd(orgCdMap.get(obj.get("usrNm").toString()));
									}else{
										obj.put("orgCdMark", 0);
									}
								}else{
									if(StringUtils.isNotBlank(cellValue)){
										_vo.setCstMgrOrgCd(cellValue);
										orgCdMap.put(obj.get("usrNm").toString(), cellValue);
									}else{
										//如果没传  查询组织架构（多个取第一个）
										SysUsrDTO sysUsrDTO = this.sysUsrService.selectSysUsrWithAuthBy(CurrentThreadContext.getCurrentSysCd(),obj.get("usrNm").toString());
										List<SysUsrFunAuthRDTO> sysUsrFunAuthRDTOs = sysUsrDTO.getSysUsrFunAuthRDTOList();
										if(CollectionUtils.isNotEmpty(sysUsrFunAuthRDTOs)){
											_vo.setCstMgrOrgCd(sysUsrFunAuthRDTOs.get(0).getOrgCd());
											orgCdMap.put(obj.get("usrNm").toString(), sysUsrFunAuthRDTOs.get(0).getOrgCd());
										}else{
											orgCdMap.put(obj.get("usrNm").toString(), null);
											obj.put("orgCdMark", 0);
										}
									}
								}
							}else{
								obj.put("orgCdMark", 0);
							}
							obj.put("orgCd", cellValue);
							break;
					}
				}
				if (StringUtils.isNotEmpty(_vo.getId())
						&& StringUtils.isNotEmpty(_vo.getCstMgrId())
						&& StringUtils.isNotBlank(_vo.getCstMgrNm())
						&& StringUtils.isNotBlank(_vo.getCstMgrOrgCd())){
					list.add(_vo);
				}
				allArr.add(obj);
			}
			//基本信息验证
			if(allArr!=null && allArr.size()>0){
				for(Object obj : allArr){
					net.sf.json.JSONObject jsn = net.sf.json.JSONObject.fromObject(obj);
					if(jsn.get("lsCntNoMark")!=null||jsn.get("usrNmMark")!=null||jsn.get("orgCdMark")!=null){
						errorArr.add(jsn);
					}
				}
			}

			//文档解析初步结果日志记录
			logger.info("ywchange,解析过程临时用户结果集合：{}",JSON.toJSONString(hcMap));
			logger.info("ywchange,解析过程临时组织架构集合:{}",JSON.toJSONString(orgCdMap));
			logger.info("ywchange,解析初步结果全部集合:{}",JSON.toJSONString(allArr));
			logger.info("ywchange,解析初步结果错误集合:{}",JSON.toJSONString(errorArr));
			logger.info("ywchange,解析初步结果可用集合:{}",JSON.toJSONString(list));

			//流程接口调用(变更发起人)
			List<PrjBscInfoVO> flowSuclist = new ArrayList<PrjBscInfoVO>();//流程调用成功数据集合
			if(CollectionUtils.isNotEmpty(list)){
				List<FlowProcessDTO> processes = new ArrayList<FlowProcessDTO>();
				//封装传输数据规则
				HashMap<String, List<PrjBscInfoVO>> fzMap = new HashMap<String, List<PrjBscInfoVO>>();
				for(PrjBscInfoVO vo: list){
					if(fzMap.containsKey(vo.getCstMgrId().toString())){
						fzMap.get(vo.getCstMgrId().toString()).add(vo);
					}else{
						List<PrjBscInfoVO> listTmp = new ArrayList<PrjBscInfoVO>();
						listTmp.add(vo);
						fzMap.put(vo.getCstMgrId().toString(), listTmp);
					}
				}
				for(Map.Entry<String, List<PrjBscInfoVO>> entry: fzMap.entrySet()){
					List<PrjBscInfoVO> listTmp = entry.getValue();
					/**
					 * 针对不同原客户经理  新客户经理 进行拆分
					 */
					HashMap<String, List<Long>> oriMap = new HashMap<String, List<Long>>();
					for(PrjBscInfoVO vo: listTmp){
						if(oriMap.containsKey(vo.getOriCstMgrId().toString())){
							oriMap.get(vo.getOriCstMgrId().toString()).add(vo.getId());
						}else{
							List<Long> prjList = new ArrayList<Long>();
							prjList.add(vo.getId());
							oriMap.put(vo.getOriCstMgrId().toString(),prjList);
						}
					}
					for(Map.Entry<String, List<Long>> oriEntry: oriMap.entrySet()){
						FlowProcessDTO processDTO = new FlowProcessDTO();
						processDTO.setInitiator(entry.getKey());
						processDTO.setInitiatorName(entry.getValue().get(0).getUsrNm());
						processDTO.setOriginInitiator(oriEntry.getKey());
						processDTO.setPrjIds(oriEntry.getValue());
						processes.add(processDTO);
					}
				}
				//记录调用流程接口前准备数据日志
				logger.info("ywchange,调用流程接口前临时缓存数据：{}",JSON.toJSONString(fzMap));
				logger.info("ywchange,调用流程接口前准备数据：{}",JSON.toJSONString(processes));
				DataResultDTO messageDTO = this.flowService.batchModifyInitiator(processes);
				//记录调用流程接口后返回数据日志
				logger.info("ywchange,调用流程接口后返回数据：{}",JSON.toJSONString(messageDTO));
				//解析返回结果
				if(messageDTO.getCode().equals(BaseConstant.IS_YESNO_YES+"")){
					List<FlowProcessDTO> processList = (List<FlowProcessDTO>)messageDTO.getData();
					if(CollectionUtils.isNotEmpty(processList)){
						for(FlowProcessDTO process : processList){
							if(!process.isSuccess()){//失败的
								for(PrjBscInfoVO vo: list){
									if(vo.getId() == process.getPrjId()){
										net.sf.json.JSONObject errobj = new net.sf.json.JSONObject();
										errobj.put("lsCntNo", vo.getLsCntNo());
										errobj.put("usrNm", vo.getUsrNm());
										errorArr.add(errobj);
										break;
									}
								}
							}else{//成功的
								for(PrjBscInfoVO vo: list){
									if(vo.getId().equals(process.getPrjId())){
										flowSuclist.add(vo);
										break;
									}
								}
							}
						}
					}else{//没有处理数据
						result.setSuccess(BaseConstant.IS_YESNO_NO);
						result.setInfo("流程处理异常（无数据），请联系系统管理员！");
						return result;
					}
				}else{
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					result.setInfo("流程处理失败，请联系系统管理员！");
					return result;
				}
			}

			logger.info("ywchange,调用流程接口后返回数据分析结果集：{}",JSON.toJSONString(flowSuclist));

			//处理业务数据
			if(CollectionUtils.isNotEmpty(flowSuclist)){
				logger.info("ywchange,更新业务数据开始");
				for(PrjBscInfoVO vo : flowSuclist){
					Long prjId = vo.getId();
					PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(prjId);
					//add 运维优化功能需求 by gengchunlan 20190722
					Long oldCstMgrId = prjBscInfoVO.getCstMgrId();//原客户经理ID
					String oldCstMgrNm=prjBscInfoVO.getCstMgrNm();//原客户经理
					String oldCstMgrOrgCd=prjBscInfoVO.getCstMgrOrgCd();//原组织架构
					//end by gengchunlan 20190722
					//基础数据
					Long cstId = prjBscInfoVO.getCstId();
					Long cstMgrId = vo.getCstMgrId();
					String cstMgrNm = vo.getCstMgrNm();
					String cstMgrOrgCd = vo.getCstMgrOrgCd();
					//更新项目数据
					logger.info("ywchange,更新项目数据开始");
					prjBscInfoVO.setCstMgrId(cstMgrId);
					prjBscInfoVO.setCstMgrNm(cstMgrNm);
					prjBscInfoVO.setCstMgrOrgCd(cstMgrOrgCd);
					prjBscInfoVO.setMdfType("YJ");
					this.prjBscInfoService.modifyPrjBscInfo(prjBscInfoVO);
					//更新付款数据
					logger.info("ywchange,更新付款数据开始");
					CapPayInfoQueryCondition cpCondition =new CapPayInfoQueryCondition();
					cpCondition.setPrjId(Long.valueOf(prjId));
					List<CapPayInfoVO> capPayInfoList = this.capPayInfoService.searchList(cpCondition);
					if(CollectionUtils.isNotEmpty(capPayInfoList)){
						for(CapPayInfoVO capPayInfoVO :capPayInfoList){
							capPayInfoVO.setCstMgrId(cstMgrId);
							capPayInfoVO.setCstMgrNm(cstMgrNm);
							capPayInfoVO.setCstMgrOrgCd(cstMgrOrgCd);
							capPayInfoVO.setBuOrgCd(WebBaseUtils.getBuOrgCd(cstMgrOrgCd));
							this.capPayInfoService.modify(capPayInfoVO);
						}
					}
					InsPlcBscInfoQueryCondition ipbCondition = new InsPlcBscInfoQueryCondition();
					ipbCondition.setPrjId(Long.valueOf(prjId));
					GetInsPlcBscInfoListRequest getRequest = new GetInsPlcBscInfoListRequest(ipbCondition);
					logger.info("查询保单信息-request：{}", JSON.toJSONString(getRequest));
					ResponseData<List<InsPlcBscInfoDTO>> getResponse = this.insPlcBscInfoService.searchList(getRequest);
					logger.info("查询保单信息-response：{}", JSON.toJSONString(getResponse));
					if (null != getRequest && ResponseData.SUCCESS_CODE.equals(getResponse.getCode()) && CollectionUtils.isNotEmpty(getResponse.getData())){
						List<InsPlcBscInfoDTO> data = getResponse.getData();
						for (InsPlcBscInfoDTO dto : data) {
							ModifyInsPlcBscInfoRequest modifyRequest = new ModifyInsPlcBscInfoRequest();
							dto.setCstMgrId(cstMgrId);
							dto.setCstMgrNm(cstMgrNm);
							dto.setCstMgrOrgCd(cstMgrOrgCd);
							dto.setBuOrgCd(WebBaseUtils.getBuOrgCd(cstMgrOrgCd));
							modifyRequest.setInsPlcBscInfoDTO(dto);
							ResponseData responseData = insPlcBscInfoService.modifyInsPlcBscInfo(modifyRequest);
							logger.info("修改保单信息，dto:{},response:{}", JSON.toJSONString(dto), JSON.toJSONString(responseData));
						}
					}
					//更新客户-客户经理关系
					logger.info("ywchange,更新客户-客户经理关系数据开始");
					CstUsrRQueryCondition curCondition = new CstUsrRQueryCondition();
					curCondition.setCstId(cstId);
					curCondition.setOpUsrId(cstMgrId);
					curCondition.setOrgCd(cstMgrOrgCd);
					List<CstUsrRVO> curList = this.cstUsrRService.searchList(curCondition);
					if(CollectionUtils.isNotEmpty(curList)){
						for(CstUsrRVO cstUsrRVO :curList){
							cstUsrRVO.setOrgCd(cstMgrOrgCd);
							cstUsrRVO.setOpTm(new Date());
							this.cstUsrRService.modify(cstUsrRVO);
						}
					}else{
						CstUsrRVO cstUsrRVO = new CstUsrRVO();
						cstUsrRVO.setCstId(cstId);
						cstUsrRVO.setOrgCd(cstMgrOrgCd);
						cstUsrRVO.setOpTm(new Date());
						cstUsrRVO.setOpUsrId(cstMgrId);
						this.cstUsrRService.add(cstUsrRVO);
					}

					// REQ-4407 add by gengchunlan 20190722
					String contractNo=prjBscInfoVO.getLsCntNo(); //原合同号
					if(StringUtils.isNotBlank(contractNo)) {
						//权证管理客户经理信息项目所属变更  start -----------
						//权证 归档
						  ArcMgrMainQC qc =new ArcMgrMainQC();
						  qc.setContractNo(contractNo);
						  List<ArcMgrMainDTO> mgrList=arcMgrMainApiService.selectList(qc);
						  if(mgrList!=null && mgrList.size()>0){
							  for(ArcMgrMainDTO mgrVo: mgrList){
								  if(mgrVo!=null) {
									  //过滤 判断与当前合同号相等
									  String mCno=mgrVo.getContractNo();
									  if(contractNo.equals(mCno)) {
										  mgrVo.setCstMgrId(Long.valueOf(cstMgrId));
										  mgrVo.setCstMgrNm(cstMgrNm);
										  mgrVo.setCstMgrOrgCd(cstMgrOrgCd);
										  mgrVo.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
										  mgrVo.setMdfTm(new Date());
										  arcMgrMainApiService.modify(mgrVo);
									  }
								  }
							  }
							  logger.info("transferMgr:{}", JSON.toJSONString(mgrList));
						  }
					      //权证 借阅
						  ArcBorrowMainQueryCondition qc2=new ArcBorrowMainQueryCondition();
						  qc2.setContractNo(contractNo);
						  List<ArcBorrowMainVO> bolist =this.arcBorrowMainService.selectList(qc2);
						  if (bolist != null && bolist.size() > 0) {
							for (ArcBorrowMainVO bo : bolist) {
								if (bo != null) {
									 //过滤 判断与当前合同号相等
									String cNo=bo.getContractNo();
									if(contractNo.equals(cNo)) {
										//过滤一下客户经理ID一致
										if(StringUtils.isNotEmpty(oldCstMgrId) && StringUtils.isNotEmpty(bo.getCstMgrId()) &&
												(oldCstMgrId.equals(bo.getCstMgrId()))) {
											bo.setCstMgrId(Long.valueOf(cstMgrId));
											bo.setCstMgrNm(cstMgrNm);
											bo.setCstMgrOrgCd(cstMgrOrgCd);
											bo.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
											bo.setMdfTm(new Date());
											arcBorrowMainService.update(bo);
										}
									}
								}
							}
							logger.info("transferBw:{}", JSON.toJSONString(bolist));
						  }
						//权证 结清移交
						ArcTransferMainQueryCondition qc3=new ArcTransferMainQueryCondition();
						qc3.setContractNo(contractNo);
						Pager page3=new Pager();
						page3.setEveryPage(100);
						page3.setCurrentPage(0);
						page3.setCondition(qc3);
						page3=this.arcTransferMainService.searchListPage(page3);
						List<ArcTransferMainDTO> trlist = (List<ArcTransferMainDTO>) page3.getResultList();
						if(trlist!=null && trlist.size()>0){
							for(ArcTransferMainDTO trVo:trlist) {
								if(trVo!=null) {
									 //过滤 判断与当前合同号相等
									String cNo=trVo.getContractNo();
									if(contractNo.equals(cNo)) {
										//过滤一下客户经理ID
										if(StringUtils.isNotEmpty(oldCstMgrId) && StringUtils.isNotEmpty(trVo.getCstMgrId()) &&
												(oldCstMgrId.equals(trVo.getCstMgrId()))) {
											trVo.setCstMgrId(Long.valueOf(cstMgrId));
											trVo.setCstMgrNm(cstMgrNm);
											trVo.setCstMgrOrgCd(cstMgrOrgCd);
											trVo.setMdfTm(new Date());
											trVo.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
											this.arcTransferMainService.update(ArcTransferMainVOTransform.toVO(trVo));
										}
									}
								}
							}
							logger.info("trVo:{}", JSON.toJSONString(trlist));
						}
						//权证管理客户经理信息项目所属变更  end by gengchunlan-----------
						//借款信息交接，只需交接未核销费用信息数据 add by gengchunlan 20190709
						Pager page4=new Pager();
						page4.setEveryPage(50);
						page4.setCurrentPage(0);
						FinLoanInfoQC qc4 = new FinLoanInfoQC();
						qc4.setContNo(contractNo);
						qc4.setMinArAmt(0l);//传0  就是查大于0
						page4.setCondition(qc4);
						Pager pager4 = this.finLoanInfoService.selectLoanPayPage(page4);
						List<FinLoanInfoDTO> fllist = (List<FinLoanInfoDTO>) pager4.getResultList();
						if (fllist!=null && fllist.size()>0) {
							for(FinLoanInfoDTO floan:fllist){
						    	if(floan!=null  && (floan.getArAmt()!=null)) {//未核销
						    		String contNo=floan.getContNo();
						    		//判断一下是否与当前合同号相等  过滤
						    		if(contractNo.equals(contNo)){
						    			//根据旧的客户经理ID查询原所属项目经理工号信息
						    			SysUsrDTO	userDto=sysUsrApiService.selectSysUsrById(Long.valueOf(oldCstMgrId), CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
						    			String gong="";
						    			if(userDto!=null && !"".equals(userDto.getUsrNm()) && null!=userDto.getUsrNm()) {
						    				gong=userDto.getUsrNm();
						    			}
						    			//根据借款人工号过滤
										if(StringUtils.isNotBlank(gong) && StringUtils.isNotBlank(floan.getCstMgrCd()) &&
												(gong.equals(floan.getCstMgrCd()))) {
							    			FinLoanInfoVO finVo=new FinLoanInfoVO();
							    			finVo.setId(floan.getId());
							    			finVo.setCstMgrId(Long.valueOf(cstMgrId));
							    			finVo.setCstMgrNm(cstMgrNm);
							    			finVo.setCstMgrOrgCd(cstMgrOrgCd);
							    			//根据新的客户经理ID查询新所属项目经理工号信息
							    			SysUsrDTO	userDtoN=sysUsrApiService.selectSysUsrById(Long.valueOf(cstMgrId), CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
							    			String gongN="";
							    			if(userDtoN!=null && !"".equals(userDtoN.getUsrNm()) && null!=userDtoN.getUsrNm()) {
							    				gongN=userDtoN.getUsrNm();
							    				finVo.setCstMgrCd(gongN);
							    			}
							    			finVo.setMdfTm(new Date());
							    			finVo.setMdfUsrId(CurrentThreadContext.getCurrentUserId());
											finLoanInfoService.modify(finVo);
										}//end 根据借款人工号过滤
						    		}
								}
						    	logger.info("floanV:{}", JSON.toJSONString(fllist));
						    }
			            }
						//end 借款信息交接
					}//end if contractNo
					//项目移交记录 add by gengchunlan 20190722
					if(prjBscInfoVO!=null) {
						PrjTransferInfoVO tvo= new PrjTransferInfoVO();
						tvo.setPrjId(prjId);// 项目ID
						tvo.setPrjNm(prjBscInfoVO.getPrjNm());//项目名称
						tvo.setContractNo(prjBscInfoVO.getLsCntNo());//合同号
						tvo.setCstMgrId(Long.valueOf(cstMgrId));//新客户经理ID
						tvo.setCstMgrNm(cstMgrNm);//新客户经理名称
						tvo.setCstMgrOrgCd(cstMgrOrgCd);//新客户经理组织架构
						tvo.setOldCstMgrId(oldCstMgrId);//原客户经理ID
						tvo.setOldCstMgrNm(oldCstMgrNm);//原客户经理名称
						tvo.setOldCstMgrOrgCd(oldCstMgrOrgCd);//原客户经理组织架构
						tvo.setCrtUsrId(CurrentThreadContext.getCurrentUserId());
						tvo.setCrtUsrNm(CurrentThreadContext.getCurrentUserName());
						logger.info("saveTransferVo:{}", JSON.toJSONString(tvo));
						prjTransferInfoService.add(tvo);//保存到数据库
					}//end by gengchunlan 20190722


					logger.info("业务移交,prjId="+prjId+"转接客户经理ID="+cstMgrId);
				}
			}
			logger.info("ywchange,最终失败数据集合：{}",JSON.toJSONString(errorArr));
			result.setData(errorArr);
		}catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("ywchange,解析excel,并进行业务及流程移交.ERROR:{},user:{}",ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("解析excel,并进行业务及流程移交错误");
			logger.error("ywchange,解析excel,并进行业务及流程移交失败,系统错误.ERROR:{},user:{}",ex.getMessage(), CurrentThreadContext.getCurrentUserName());
		}
		Long endTm = System.currentTimeMillis();
		logger.info("ywchange,业务及流程移请求耗时："+(endTm-startTm));
		return result;
	}

	/**
	 * 机构签约回调
	 * @param request
	 * @param response
	 * @param id
	 * @return
	 * @throws BaseException
	 */
	@RequestMapping(value = "/{id}/signback.do", method = { RequestMethod.POST,RequestMethod.GET })
	public ModelAndView modifyOrgSignInfo(HttpServletRequest request, HttpServletResponse response, @PathVariable("id") Long id) throws BaseException {
		logger.info("modifyOrgSignInfo,三方机构签约回调==" + id);
		ModelAndView mav = new ModelAndView("project/prjbscinfo/prjSignInfo");
		if(StringUtils.isEmpty(id)){
			logger.info("modifyOrgSignInfo,三方机构签约回调无效，项目Id为空==");
			mav.addObject("desc","签约返回异常");
		}else{
			PrjBscInfoVO prjBscInfoVO = new PrjBscInfoVO();
			prjBscInfoVO.setId(id);
			prjBscInfoVO.setOrgSignStsCd(String.valueOf(BaseConstant.IS_YESNO_YES));
			prjBscInfoVO.setOrgSignDt(new Date());
			boolean flag = this.prjBscInfoService.modifySignInfo(prjBscInfoVO);
			if(flag){
				logger.info("modifyOrgSignInfo,三方机构签约回调成功，项目="+id);
				mav.addObject("desc","签约成功");
			}else{
				logger.info("modifyOrgSignInfo,三方机构签约回调成功，修改签约状态失败，项目="+id);
				mav.addObject("desc","签约失败");
			}
		}
		return mav;
	}

	/**
	 * 初始化担保项目列表
	 * @author Fengzx
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/prjBscInfoList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object prjBscInfoList(HttpServletRequest request,
								 HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String prjNm = request.getParameter("prjNm");
		String cstNm = request.getParameter("cstNm");
		String prjTyCd = request.getParameter("prjTypCd");
		String bizTypCd = request.getParameter("bizTypCd");
		String prjStsCd = request.getParameter("prjStsCd");
		String buOrgCd = request.getParameter("buOrgCd");// 事业部
		String cstId = request.getParameter("cstId");// 客户ID
		String splId = request.getParameter("splId");// 供应商ID(YAOXIURONG)
		String lsCntNo = request.getParameter("lsCntNo");
		String lnkCompId = request.getParameter("lnkCompId");// 挂靠公司ID
		String cstMgrNm = request.getParameter("cstMgrNm");// 客户经理
		String cntTypCd = request.getParameter("cntTypCd");
		String isDel = request.getParameter("isDel");//是否删除
		String cstMgrOrgCd = request.getParameter("cstMgrOrgCd");
		String userNm = request.getParameter("userNm");
		String ovdViewFlag = request.getParameter("ovdViewFlag");
		String cstMgrId = request.getParameter("cstMgrId");
		String mfrId = request.getParameter("mfrId");//厂商ID
		String insCode = request.getParameter("insCode");
		String fundRasInsId = request.getParameter("fundRasInsId");

		PrjCstBscInfoQueryCondition prjCstBscInfoQC = new PrjCstBscInfoQueryCondition();
		if(StringUtils.isNotEmpty(cstId)){
			prjCstBscInfoQC.setCstId(Long.valueOf(cstId));
		}
		if(StringUtils.isNotEmpty(cstNm)){
			prjCstBscInfoQC.setCstNm(cstNm);
		}
		prjCstBscInfoQC.setCstRlTyp("2");
		prjCstBscInfoQC.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		prjCstBscInfoQC.setSysCd(CurrentThreadContext.getCurrentSysCd());
		List<PrjCstBscInfoVO> prjCstBscInfoVOs = this.prjCstBscInfoService.searchList(prjCstBscInfoQC);
		List<Long> prjIdList = new ArrayList<>();
		if(CollectionUtils.isNotEmpty(prjCstBscInfoVOs)){
			for (PrjCstBscInfoVO prjCstBscInfoVO : prjCstBscInfoVOs) {
				prjIdList.add(prjCstBscInfoVO.getPrjId());
			}
		}
		logger.info("searchList,项目ID集合："+JSON.toJSONString(prjIdList));
		if(CollectionUtils.isEmpty(prjIdList)){
			return null;
		}
		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}
		PrjBscInfoQueryCondition qc = new PrjBscInfoQueryCondition();
		if(StringUtils.isNotBlank(isDel)){
			qc.setIsDel(Integer.valueOf(isDel));
		}
		if (StringUtils.isNotBlank(prjStsCd)) {
			if (prjStsCd.equals(FlowConstant.FLOW_CHECK_STATE_NON)) {
				qc.setDefPrjStsCd(prjStsCd);
			} else {
				qc.setPrjStsCd(prjStsCd);
			}
		}
		qc.setIdList(prjIdList);
		qc.setUsrId(CurrentThreadContext.getCurrentUserId());
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		page.setCondition(qc);
		Pager pager = this.prjBscInfoService.searchListPage(page);
		List<PrjBscInfoVO> list = (List<PrjBscInfoVO>) pager.getResultList();
		if(CollectionUtils.isNotEmpty(list) && "ovdViewFlag".equals(ovdViewFlag)){
			this.prjBscInfoService.putOvdDataToPrjBscInfo(list);
		}
		ListPageVO<PrjBscInfoVO> listPage = new ListPageVO<PrjBscInfoVO>(list,
				pager.getTotalCount());
		return listPage;
	}
	/**
	 *
	 * 跳转紧急联系人页面  
	 */
	@RequestMapping(value = "/toAddEmergencyContactList.do", method = { RequestMethod.GET })
	public ModelAndView addEmergencyContactList(HttpServletRequest request,HttpServletResponse response) {
		logger.info("加载PrjBscInfo列表页面.");
		ModelAndView view = new ModelAndView("project/prjbscinfo/EmergencyContactadd");
		String isFlow = request.getParameter("isFlow");//标识
		String detailFlag = request.getParameter("detailFlag");//初始化：false,查看：true
		String prjId = request.getParameter("prj_id");//项目id
		List<KeyValueVO> genderCdList = this.cstBscInfoService.searchGenderCdList();//性别
		List<KeyValueVO> rlCdList = this.prjBscInfoService.getRlCdList();//与承租人关系
		view.addObject("isFlow", isFlow);
		view.addObject("detailFlag", detailFlag);
		view.addObject("prjId", prjId);
		view.addObject("genderCdList", JSON.toJSONString(genderCdList));
		view.addObject("rlCdList", JSON.toJSONString(rlCdList));
		return view;
	}



	/**
	 * 到系统运维项目列表页面
	 */
	@RequestMapping(value = "/toPrjBscInfoQueryListPage.do", method = { RequestMethod.GET })
	public ModelAndView toPrjBscInfoQueryListPage(HttpServletRequest request,
												  HttpServletResponse response) {
		logger.info("加载PrjBscInfo列表页面.");
		ModelAndView view = new ModelAndView(
				"project/prjbscinfo/projectSystemPrjBscInfoList");
		Pager page = new Pager();
		page.setCurrentPage(1);
		page.setEveryPage(Integer.MAX_VALUE);
		FriBaseInfoQueryCondition qc = new FriBaseInfoQueryCondition();
		qc.setInsSts(FriBaseInfoConstant.FRI_BASE_INFO_INS_STS_PASS);
		qc.setInsUseCd("2");
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		qc.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
		page.setCondition(qc);
		Pager pager = this.friBaseInfoService.searchListPage(page);
		List<FriBaseInfoVO> list = (List<FriBaseInfoVO>) pager.getResultList();
		view.addObject("friBaseList", list);
		view.addObject("queryFlag", "query");// 查询列表隐藏操作按钮
		//view.addObject("updateFlag", "update");//业务移交、供应商修改
		view.addObject("currentBuOrgCd",
				CurrentThreadContext.getCurrentBuOrgCd());
		return view;
	}


	/**
	 * 到系统运维项目信息修改页面
	 */
	@RequestMapping(value = "/toModifySystemPage.do", method = { RequestMethod.GET,RequestMethod.POST })
	public ModelAndView toModifySystemPage(HttpServletRequest request, HttpServletResponse response) {
		String id = request.getParameter("id");
		String showTabs = request.getParameter("showTabs");
		logger.info("加载PrjBscInfo Modify页面.");
		String fromPrjFlag = request.getParameter("fromPrjFlag");
		String cstId = request.getParameter("cstId");
		String cstNm = request.getParameter("cstNm");
		String isFlow = request.getParameter("isFlow");
		String detailFlag = request.getParameter("detailFlag");
		String ywParam = request.getParameter("ywParam");
		String buOrgCd = request.getParameter("buOrgCd");
		//********流程参数开始********//
		String preTaskIds = request.getParameter("preTaskIds");//流程上一个节点任务ID,多个以逗号分割.
		String processInstanceId = request.getParameter("processInstanceId");//流程实例ID
		//********流程参数结束********//
		if(StringUtils.isEmpty(id)){
			throw new BaseException(BaseExceptionConstant.BASE_EXCEPTION_CODE_600,"项目ID不能为空");
		}
		PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long.valueOf(id));

		// 查询当前登录人是不是客户经理
		Long currRoleId = CurrentThreadContext.getCurrentRoleId();// 当前登录角色ID
		boolean flag = this.prjBscInfoService.getCurrentUserRoleStatus(currRoleId);// 判断当前用户是不是客户经理
		Long cstMgrId = null;
		List<SysUsrVO> actMgrList = null;
		if (flag) {
			if(StringUtils.isNotBlank(prjBsc.getCstMgrOrgCd())){
				//PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long.valueOf(id));
				actMgrList = this.prjBscInfoService.getCstMgrListByOrgId(prjBsc.getCstMgrOrgCd());
			}else{
				cstMgrId = CurrentThreadContext.getCurrentUserId();
				actMgrList = new ArrayList<SysUsrVO>();
				SysUsrVO usrVo = this.sysUsrService.selectById(cstMgrId,CurrentThreadContext.getCurrentSysCd());
				if (null != usrVo) {
					usrVo.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
				}
				actMgrList.add(usrVo);
			}
		} else {
			if(StringUtils.isNotBlank(id)){
				actMgrList = this.prjBscInfoService.getCstMgrListByOrgId(prjBsc.getCstMgrOrgCd());
			}else{
				actMgrList = this.prjBscInfoService.getCstMgrListByOrgId(CurrentThreadContext.getCurrentOrgCd());
			}
		}
		if (CollectionUtils.isEmpty(actMgrList) && StringUtils.isNotBlank(id)) {
			// 查询
			//PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long.valueOf(id));
			actMgrList = this.prjBscInfoService.getCstMgrListByOrgId(prjBsc.getCstMgrOrgCd());
		}
		// 事业部
		List<String> orgCds = new ArrayList<>();
		String cstMgrOrgCd = "";
		if (("true").equals(detailFlag)||StringUtils.isNotBlank(id)) {
			//PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long.valueOf(id));
			cstMgrOrgCd = prjBsc.getCstMgrOrgCd();

			orgCds.add(prjBsc.getBuOrgCd());
			orgCds.add(prjBsc.getCstMgrOrgCd());
		} else {
			orgCds.add(CurrentThreadContext.getCurrentBuOrgCd());
			orgCds.add(CurrentThreadContext.getCurrentOrgCd());
		}
		//PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long.valueOf(id));
		String bizModCd = prjBsc.getBizModCd();
		String prjTypCd = prjBsc.getPrjTypCd();
		String pledgeCd = prjBsc.getPledge();//抵押       (tsn)
		String mainGdsTypCd = prjBsc.getMainGdsTypCd();//主货物大类
		String goodsRes = prjBsc.getGoodsRes();//主运输货物
		List<KeyValueVO> bizTypCdList = new ArrayList<KeyValueVO>();
		if(("true").equals(detailFlag)||StringUtils.isNotBlank(id)){
			bizTypCdList = this.prjBscInfoService.getBizTypCdList();// 业务模式
		}else{
			bizTypCdList = this.prjBscInfoService.getBizTypCdDetailList();// 业务模式
		}
		if(StringUtils.isBlank(buOrgCd)){
			buOrgCd = prjBsc.getBuOrgCd();
		}
		List<KeyValueVO> cntTypCdList = this.prjBscInfoService.getCntTypCdList();// 合同签署方式
		List<KeyValueVO> yesNoList = this.prjBscInfoService.getYesNoList();
		//是否需要抵押(tsn)
		List<KeyValueVO> kvList = this.sysDictionaryApiService.getKvList(PrjBscInfoConstant.CODE_PLEDJE, CurrentThreadContext.getCurrentSysCd(), CurrentThreadContext.getCurrentOrgCd());
		//主货物大类
		List<KeyValueVO> mainGdsTypCdList = this.audCreditInfoService.searchGoodsTypListByLvl("1");
		//货物来源
		List<KeyValueVO> goodsResList = this.audReturnVisitService.searchGoodsResList();
		// 是否从项目新增
		ModelAndView view = new ModelAndView("project/prjbscinfo/projectPrjBscInfoSystemAdd");

		view.addObject("detailFlag", detailFlag);
		/* view.addObject("dsList", dsList); */
		view.addObject("bizModCd", bizModCd);
		view.addObject("prjTypCd", prjTypCd);
		view.addObject("showTabs", showTabs);
		view.addObject("fromPrjFlag", fromPrjFlag);
		view.addObject("cstMgrOrgCd", cstMgrOrgCd);
		view.addObject("cstId", cstId);
		view.addObject("cstNm", cstNm);
		view.addObject("ywParam", ywParam);
		view.addObject("buOrgCd", buOrgCd);
		view.addObject("id", id);
		view.addObject("detailFlag", detailFlag);
		view.addObject("orgCds", orgCds);
		view.addObject("cstMgrId", cstMgrId);
		view.addObject("bizTypCdList", bizTypCdList);
		view.addObject("cntTypCdList", cntTypCdList);// 合同签署方式
		view.addObject("actMgrList", actMgrList);
		view.addObject("mgrFlag", flag);
		view.addObject("currOrgId", CurrentThreadContext.getCurrentOrgId());
		view.addObject("currOrg", prjBsc.getCstMgrOrgCd());//客户经理组织结构
		view.addObject("isFlow", isFlow);
		view.addObject("cstId", prjBsc.getCstId());
		view.addObject("yesNoList",yesNoList);
		//********流程参数开始********//
		view.addObject("preTaskIds", preTaskIds);
		view.addObject("pInstId", processInstanceId);
		view.addObject("kvList", kvList);// diya  (tsn)
		view.addObject("pledgeCd", pledgeCd);//diya   (tsn)
		view.addObject("mainGdsTypCdList", mainGdsTypCdList);
		view.addObject("goodsResList", goodsResList);
		view.addObject("mainGdsTypCd", mainGdsTypCd);
		view.addObject("goodsRes", goodsRes);

		//********流程参数结束********//
		/* view.addObject("loanTypCdList", loanTypCdList); */

		//车抵贷业务 查询车抵贷预约编号
		if(StringUtils.isNotBlank(prjBsc.getPrjTypCd())&&PrjBscInfoConstant.PRJ_TYP_CD_CDDYW.equals(prjBsc.getPrjTypCd())){
			OdrBscInfoVO odrBscInfoVO = this.odrBscInfoService.selectById(prjBsc.getId());
			if(null != odrBscInfoVO){
				view.addObject("odrNo", odrBscInfoVO.getOdrNo());//车抵贷预约编号
			}
		}

		//查询银行列表
		List<KeyValueVO> bankList = this.prjBscInfoService.searchCdList(PrjCstAccInfoConstant.CODE_CZB_SUPPORT_BANK_CD);
		view.addObject("bankList",JSON.toJSONString(bankList));
		//浙商特殊处理
		if(StringUtils.isNotBlank(prjBsc.getInsCode())&&PrjBscInfoConstant.PRJ_INS_CODE_ZS.equals(prjBsc.getInsCode())){
			if(null != prjBsc.getPrjCstAccInfoVO()){
				view.addObject("certNo", prjBsc.getPrjCstAccInfoVO().getCertNo());
				view.addObject("certTypCd", prjBsc.getPrjCstAccInfoVO().getCertTypCd());
				view.addObject("bkNm", prjBsc.getPrjCstAccInfoVO().getBkNm());
				view.addObject("bkNo", prjBsc.getPrjCstAccInfoVO().getBkNo());
				view.addObject("accNo", prjBsc.getPrjCstAccInfoVO().getAccNo());
				view.addObject("mp", prjBsc.getPrjCstAccInfoVO().getMp());
			}
			//自然人客户
			view.addObject("cstTypCd", CustomerConstant.CST_TYP_CD_NP);
			//浙商 暂不支持法人客户
			CstNpBscInfoVO cstNpBscInfoVO = this.cstNpBscInfoService.selectById(prjBsc.getCstId());
			if(null != cstNpBscInfoVO){
				view.addObject("certValidSDt", cstNpBscInfoVO.getCertValidSDt());
				view.addObject("certValidEDt", cstNpBscInfoVO.getCertValidEDt());
			}
		}
		//苏宁特殊处理
		if(StringUtils.isNotBlank(prjBsc.getInsCode())&&PrjBscInfoConstant.PRJ_INS_CODE_SN.equals(prjBsc.getInsCode())){
			if(null != prjBsc.getPrjCstAccInfoVO()){
				view.addObject("certNo", prjBsc.getPrjCstAccInfoVO().getCertNo());
				view.addObject("certTypCd", prjBsc.getPrjCstAccInfoVO().getCertTypCd());
				view.addObject("bkNm", prjBsc.getPrjCstAccInfoVO().getBkNm());
				view.addObject("bkNo", prjBsc.getPrjCstAccInfoVO().getBkNo());
				view.addObject("accNo", prjBsc.getPrjCstAccInfoVO().getAccNo());
				view.addObject("mp", prjBsc.getPrjCstAccInfoVO().getMp());
				view.addObject("insAccNo", prjBsc.getPrjCstAccInfoVO().getInsAccNo());
			}
			//自然人客户
			view.addObject("cstTypCd", CustomerConstant.CST_TYP_CD_NP);
			//浙商 暂不支持法人客户
			CstNpBscInfoVO cstNpBscInfoVO = this.cstNpBscInfoService.selectById(prjBsc.getCstId());
			if(null != cstNpBscInfoVO){
				view.addObject("certValidSDt", cstNpBscInfoVO.getCertValidSDt());
				view.addObject("certValidEDt", cstNpBscInfoVO.getCertValidEDt());
			}
		}

		//网商支付宝账号
		if(StringUtils.isNotBlank(prjBsc.getInsCode())&&PrjBscInfoConstant.PRJ_INS_CODE_WS.equals(prjBsc.getInsCode())){
			if(null != prjBsc.getPrjCstAccInfoVO()){
				view.addObject("wsAccNo", prjBsc.getPrjCstAccInfoVO().getAccNo());
			}
		}

		logger.info("add,项目详情 到修改页面 :: prjBscInfo.getInsCode() = " + prjBsc.getInsCode());
		// 查找资管机构模块配置
		if(StringUtils.isNotBlank(prjBsc.getInsCode()) && !PrjBscInfoConstant.PRJ_INS_CODE_SQ.equals(prjBsc.getInsCode())) {
			SysInsTabCfgVO sysInsTabCfgVO = this.sysInsTabCfgService.selectByInsCode(prjBsc.getInsCode());
			if(sysInsTabCfgVO != null) {
				view.addObject("sysInsTabCfgVO", sysInsTabCfgVO);
			}
		}

		return view;
	}


	/**
	 * 修改系统运维项目信息
	 */
	@RequestMapping(value = "/modifyprjBscInfoSystem.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object modifyprjBscInfoSystem(HttpServletRequest request,
										 HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		String prjTypCd = request.getParameter("prjTypCd");
		String bizTypCd = request.getParameter("bizTypCd");
		String cntTypCd = request.getParameter("cntTypCd");

		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				"修改成功!");
		if (StringUtils.isEmpty(id)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("参数不完整！");
			return result;
		}
		try {
			PrjBscInfoDTO entity = new PrjBscInfoDTO();
			entity.setId(Long.valueOf(id));
			entity.setPrjTypCd(prjTypCd);
			entity.setBizTypCd(bizTypCd);
			entity.setCntTypCd(cntTypCd);
			boolean success = this.projectApiService.modifyPrjBscInfo2(entity);
			if (!success) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("修改失败！");
			}
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("修改失败！msg:{}",ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("修改失败!");
			logger.error("修改失败！msg:{}",ex.getMessage());
		}
		return result;
	}


	/**
	 * 到系统运维资信整体查看大页面
	 */
	@RequestMapping(value = "/toPrjDetailInvestRptSystemPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjDetailInvestRptSystemPage(HttpServletRequest request,
													   HttpServletResponse response) {
		logger.info("加载toPrjInvestRptPage 页面.");
		String prjId = request.getParameter("prjId");// 项目ID
		String cstRlCd = request.getParameter("cstRlCd");
		CstBscInfoVO cstBscInfoVO = null;
		String cstType = "";
		Long cstId = null;
		Integer age = null;
		// 自然人配偶
		CstNpSocialRlVO rlVo = null;
		if (StringUtils.isNotBlank(prjId)) {
			cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
					.valueOf(prjId));
			if (null != cstBscInfoVO) {
				cstType = cstBscInfoVO.getCstTypCd();
				cstId = cstBscInfoVO.getId();
			}
		}
		PrjCstProfitAnaVO profit = null;
		PrjCstInvestRptVO rpt = null;
		PrjCstRepayAbiVO abi = null;
		CstNpBscInfoVO npInfo = null;
		CstCorpBscInfoVO corpInfo = null;
		CstBscInfoVO bscInfo = null;
		PrjBscInfoVO prjBscInfoVO = null;
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		if (StringUtils.isNotBlank(prjId) && null != cstId) {
			prjBscInfoVO = this.prjBscInfoService.selectById(Long
					.valueOf(prjId));
			rpt = this.prjCstInvestRptService
					.getPrjCstInvestRptByPrjIdAndCstId(Long.valueOf(prjId),
							cstId, cstRlCd);// 通过项目和客户id查询客户调查报告
			profit = this.prjCstProfitAnaService
					.getPrjCstProfitAnaByPrjIdAndCstId(Long.valueOf(prjId),
							cstId);// 通过项目和客户id查询客户调查报告
			abi = this.prjCstRepayAbiService.getPrjCstRepayAbiByPrjIdAndCstId(
					Long.valueOf(prjId), cstId, cstRlCd);// 通过项目和客户id查询客户还款能力
			bscInfo = this.cstBscInfoService.selectDetailById(cstId);
			if (null != prjBscInfoVO) {
				orgCd = prjBscInfoVO.getBuOrgCd();
			}
			if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
				// 自然人
				npInfo = bscInfo.getCstNpBscInfoVO();
				if (null != npInfo.getBirthday()) {
					npInfo.setAge(DateUtils.getYear(new Date())
							- DateUtils.getYear(DateUtils.formatStringToDate(
							npInfo.getBirthday(), DateUtils.YYYY_MM_DD)));// 生日
				}
				// 自然人配偶
				rlVo = npInfo.getCstNpSocialRlVO();
				if (null != rlVo&&rlVo.getCertTypCd().equals(PrjCstBscInfoConstant.CERT_TYP_CD_ID_CARD)) {
					// 计算配偶年龄
					String idCard = rlVo.getCertNo();
					//只有大陆的身份证计算年龄，香港的不计算
					if(!(idCard.length()<6||idCard.length()<14)){
						String birthday = idCard.substring(6, 14);
						Date birthdate = DateUtils.formatStringToDate(birthday,
								DateUtils.YYYYMMDD);
						Calendar currentDay = Calendar.getInstance();
						currentDay.setTime(birthdate);
						int year = currentDay.get(Calendar.YEAR);
						// 获取年龄
						SimpleDateFormat simpleDateFormat = new SimpleDateFormat(
								"yyyy");
						String currYear = simpleDateFormat.format(new Date());
						age = Integer.parseInt(currYear) - year;
					}
				}

			}
			if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
				// 法人
				corpInfo = bscInfo.getCstCorpBscInfoVO();// 法人基础信息
			}
		}
		// 查询合格证信息
		AudCreditInfoVO tk = null;

		AuditCreditInfoQueryCondition condition = new AuditCreditInfoQueryCondition();
		condition.setProjectId(Long.valueOf(prjId));
		AudCreditInfoListRequest listRequest = new AudCreditInfoListRequest(condition,
				CurrentThreadContext.getCurrentSysCd(),
				CurrentThreadContext.getCurrentOrgCd());
		ResponseData<List<AuditCreditInfoDTO>> responseData = auditCreditInfoService.searchList(listRequest);
		logger.info("toPrjDetailInvestRptSystemPage,查询信审整体资料,结果:{},user:{}",JSONObject.toJSONString(responseData), CurrentThreadContext.getCurrentUserName());

		if (responseData != null && ResponseData.SUCCESS_CODE.equals(responseData.getCode()) && responseData.getData() != null) {
			List<AuditCreditInfoDTO> data = responseData.getData();
			if (CollectionUtils.isNotEmpty(data)) {
				AuditCreditInfoDTO dto = data.get(0);
				tk = new AudCreditInfoVO();
				BeanUtils.copyProperties(dto, tk);
				tk.setHouseCret(dto.getHouseCert());
				tk.setFareType(dto.getFareTypeCd());
				tk.setChargingType(dto.getChargingTypeCd());
				tk.setHandingMode(dto.getHandlingMode());
			}
		}

		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			rpt = new PrjCstInvestRptVO();
			rpt.setInvestor(prjBscInfoVO.getCstMgrNm());
			Pager page = new Pager();
			PrjBscInfoQueryCondition prjQc = new PrjBscInfoQueryCondition();
			List<Long> idList = new ArrayList<Long>();
			idList.add(Long.valueOf(prjId));
			prjQc.setIdList(idList);
			prjQc.setUsrId(prjBscInfoVO.getCrtUsrId());
			prjQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
			prjQc.setOrgCd(prjBscInfoVO.getCstMgrOrgCd());
			page.setCondition(prjQc);
			page.setCurrentPage(1);
			page.setEveryPage(Integer.MAX_VALUE);
			Pager pager = this.prjBscInfoService.searchListPage(page);
			List<PrjBscInfoVO> list = (List<PrjBscInfoVO>) pager
					.getResultList();
			PrjBscInfoVO bsc = null;
			if (CollectionUtils.isNotEmpty(list)) {
				bsc = list.get(0);
				if (bsc.getApplyDt() != null) {
					rpt.setRptDt(bsc.getApplyDt());
				}
			}
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			if (StringUtils.isNotBlank(prjId) && null != cstId) {
				rpt = this.prjCstInvestRptService
						.getPrjCstInvestRptByPrjIdAndCstId(Long.valueOf(prjId),
								cstId, cstRlCd);// 通过项目和客户id查询客户调查报告
			}
		}

		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		// 查承租人照片配置信息
		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_NP);
			qc.setCfgCdList(codeList);
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_LP);
			qc.setCfgCdList(codeList);
		}

		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		SysUlDatCfgVO cfg = null;
		if (CollectionUtils.isNotEmpty(list)) {
			cfg = list.get(0);
		}
		List<SysUlDatCfgDtlVO> dtlList = cfg.getSysUlDatCfgDtlVOList();
		List<SysUlFilesRecVO> dtlFileList = new ArrayList<SysUlFilesRecVO>();
		/*
		 * SysUlFilesRecQueryCondition ulFileQc = new
		 * SysUlFilesRecQueryCondition();
		 * ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
		 * ulFileQc.setSysCd(qc.getSysCd());
		 * ulFileQc.setOrgCd(PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG);
		 * ulFileQc.setPkId(prjId); ulFileQc.setTabNm("PRJ_BSC_INFO");
		 * List<SysUlFilesRecVO> fileList =
		 * sysUlFilesRecService.searchList(ulFileQc);
		 */
		if (CollectionUtils.isNotEmpty(dtlList)) {
			for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : dtlList) {
				SysUlFilesRecQueryCondition ulFileQc = new SysUlFilesRecQueryCondition();
				ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
				ulFileQc.setSysCd(qc.getSysCd());
				ulFileQc.setOrgCd(orgCd);
				ulFileQc.setPkId(prjId);
				ulFileQc.setTabNm("PRJ_BSC_INFO");
				ulFileQc.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
				List<SysUlFilesRecVO> fileList = sysUlFilesRecService
						.searchList(ulFileQc);
				if (CollectionUtils.isNotEmpty(fileList)) {
					// sysUlDatCfgDtlVO.setFileRecList(fileList);
					for (SysUlFilesRecVO sysUlFilesRecVO : fileList) {
						sysUlFilesRecVO.setDatNm(sysUlDatCfgDtlVO.getDatNm());
						sysUlFilesRecVO.setDatNm(sysUlDatCfgDtlVO.getDatNm());
						sysUlFilesRecVO.setCfgCd(sysUlDatCfgDtlVO.getCfgCd());
						sysUlFilesRecVO.setSysCd(CurrentThreadContext
								.getCurrentSysCd());
						sysUlFilesRecVO.setOrgCd(orgCd);
						sysUlFilesRecVO.setCfgDtlCd(sysUlDatCfgDtlVO
								.getCfgDtlCd());
						dtlFileList.add(sysUlFilesRecVO);
						/*
						 * if(sysUlDatCfgDtlVO.getCfgDtlCd().equals(sysUlFilesRecVO
						 * .getCfgDtlCd())&&sysUlDatCfgDtlVO.getCfgCd().equals(
						 * sysUlFilesRecVO.getCfgCd())){
						 * sysUlDatCfgDtlVO.setFileRec(sysUlFilesRecVO); break;
						 * }
						 */
					}
					//
				} else {
					SysUlFilesRecVO filesRecVO = new SysUlFilesRecVO();
					filesRecVO.setDatNm(sysUlDatCfgDtlVO.getDatNm());
					filesRecVO.setCfgCd(sysUlDatCfgDtlVO.getCfgCd());
					filesRecVO.setSysCd(CurrentThreadContext.getCurrentSysCd());
					filesRecVO.setOrgCd(orgCd);
					filesRecVO.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
					dtlFileList.add(filesRecVO);
				}
			}
		}

		// 查询担保人信息
		// 法人
		// 自然人
		PrjCstBscInfoQueryCondition cstQc = new PrjCstBscInfoQueryCondition();
		cstQc.setPrjId(Long.valueOf(prjId));
		cstQc.setCstRlTyp(PrjCstBscInfoConstant.CST_Rl_ATTR_GUARANTOR);
		List<PrjCstBscInfoVO> cstList = this.prjCstBscInfoService
				.searchList(cstQc);
		Map<String, List<SysUlFilesRecVO>> npMap = new HashMap<String, List<SysUlFilesRecVO>>();// 自然人
		Map<String, List<SysUlFilesRecVO>> lpMap = new HashMap<String, List<SysUlFilesRecVO>>();// 法人

		for (PrjCstBscInfoVO prjCstBscInfoVO : cstList) {

			SysUlDatCfgQueryCondition fileQc = new SysUlDatCfgQueryCondition();
			if (prjCstBscInfoVO.getCstTypCd().equals(
					CustomerConstant.CST_TYP_CD_NP)) {
				List<String> codeList = new ArrayList<String>();
				codeList.add(PrjBscInfoConstant.CODE_GUAR_SURVEY_PHOTO_NP);
				fileQc.setCfgCdList(codeList);
			}
			if (prjCstBscInfoVO.getCstTypCd().equals(
					CustomerConstant.CST_TYP_CD_CORP)) {
				List<String> codeList = new ArrayList<String>();
				codeList.add(PrjBscInfoConstant.CODE_GUAR_SURVEY_PHOTO_LP);
				fileQc.setCfgCdList(codeList);
			}
			fileQc.setOrgCd(orgCd);
			fileQc.setSysCd(CurrentThreadContext.getCurrentSysCd());
			List<SysUlDatCfgVO> cfglist = sysUlDatCfgService.searchList(fileQc);
			SysUlDatCfgVO cfgVo = null;
			if (CollectionUtils.isNotEmpty(cfglist)) {
				cfgVo = cfglist.get(0);
			}
			List<SysUlDatCfgDtlVO> guarDtlList = cfgVo
					.getSysUlDatCfgDtlVOList();
			List<SysUlFilesRecVO> guarDtlFileList = new ArrayList<SysUlFilesRecVO>();
			/*
			 * SysUlFilesRecQueryCondition guarUlFileQc = new
			 * SysUlFilesRecQueryCondition();
			 * guarUlFileQc.setCfgCd(fileQc.getCfgCdList().get(0));
			 * guarUlFileQc.setSysCd(fileQc.getSysCd());
			 * guarUlFileQc.setOrgCd(PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG);
			 * guarUlFileQc.setPkId(prjCstBscInfoVO.getId().toString());
			 * guarUlFileQc.setTabNm("PRJ_CST_BSC_INFO"); List<SysUlFilesRecVO>
			 * guarFileList = sysUlFilesRecService.searchList(guarUlFileQc);
			 */
			if (CollectionUtils.isNotEmpty(guarDtlList)) {
				for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : guarDtlList) {
					SysUlFilesRecQueryCondition guarUlFileQc = new SysUlFilesRecQueryCondition();
					guarUlFileQc.setCfgCd(fileQc.getCfgCdList().get(0));
					guarUlFileQc.setSysCd(fileQc.getSysCd());
					guarUlFileQc.setOrgCd(orgCd);
					guarUlFileQc.setPkId(prjCstBscInfoVO.getId().toString());
					guarUlFileQc.setTabNm("PRJ_CST_BSC_INFO");
					guarUlFileQc.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
					List<SysUlFilesRecVO> guarFileList = sysUlFilesRecService
							.searchList(guarUlFileQc);
					if (CollectionUtils.isNotEmpty(guarFileList)) {
						for (SysUlFilesRecVO sysUlFilesRecVO : guarFileList) {
							sysUlFilesRecVO.setDatNm(sysUlDatCfgDtlVO
									.getDatNm());
							sysUlFilesRecVO.setCfgCd(sysUlDatCfgDtlVO
									.getCfgCd());
							sysUlFilesRecVO.setSysCd(fileQc.getSysCd());
							sysUlFilesRecVO.setOrgCd(orgCd);
							sysUlFilesRecVO.setCfgDtlCd(sysUlDatCfgDtlVO
									.getCfgDtlCd());
							guarDtlFileList.add(sysUlFilesRecVO);
							/*
							 * if(sysUlDatCfgDtlVO.getCfgDtlCd().equals(
							 * sysUlFilesRecVO
							 * .getCfgDtlCd())&&sysUlDatCfgDtlVO.getCfgCd
							 * ().equals(sysUlFilesRecVO.getCfgCd())){
							 * sysUlDatCfgDtlVO.setFileRec(sysUlFilesRecVO); }
							 */
						}
						// sysUlDatCfgDtlVO.setFileRecList(guarFileList);
					} else {
						SysUlFilesRecVO fileVo = new SysUlFilesRecVO();
						fileVo.setDatNm(sysUlDatCfgDtlVO.getDatNm());
						fileVo.setCfgCd(sysUlDatCfgDtlVO.getCfgCd());
						fileVo.setSysCd(fileQc.getSysCd());
						fileVo.setOrgCd(orgCd);
						fileVo.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
						guarDtlFileList.add(fileVo);
					}
				}
			}

			if (prjCstBscInfoVO.getCstTypCd().equals(
					CustomerConstant.CST_TYP_CD_NP)) {
				npMap.put(prjCstBscInfoVO.getCstNm(), guarDtlFileList);
			}
			if (prjCstBscInfoVO.getCstTypCd().equals(
					CustomerConstant.CST_TYP_CD_CORP)) {
				lpMap.put(prjCstBscInfoVO.getCstNm(), guarDtlFileList);
			}

		}

		String serverPath = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_SERVER_PATH);// 服务地址
		String customerPah = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_COSTOMER_PATH);
		String headPic = PropertiesCacheUtils
				.getProperty(fl.constant.facade.framework.constant.UploadConstant.DEFAULT_NO_PIC);
		ModelAndView view = new ModelAndView(
				"project/prjcstinvestrptinfo/prjCstInvestRptInfoSystemDetail");
		view.addObject("prjId", prjId);
		view.addObject("cstType", cstType);
		view.addObject("cstId", cstId);
		view.addObject("profit", profit);
		view.addObject("rpt", rpt);
		view.addObject("abi", abi);
		view.addObject("npInfo", npInfo);
		view.addObject("corpInfo", corpInfo);
		view.addObject("bscInfo", bscInfo);
		view.addObject("cstRlCd", cstRlCd);
		view.addObject("dtlList", dtlFileList);
		view.addObject("tk", tk);
		view.addObject("defImg", serverPath + customerPah + headPic);
		view.addObject("prjCstInvestRpt", rpt);
		view.addObject("npMap", npMap);
		view.addObject("lpMap", lpMap);
		view.addObject("age", age);
		view.addObject("rlVo", rlVo);
		return view;
	}


	/**
	 * 到系统运维资信添加页面-new
	 */
	@RequestMapping(value = "/toPrjInvestSystemAddPage.do", method = {
			RequestMethod.GET, RequestMethod.POST })
	public ModelAndView toPrjInvestSystemAddPage(HttpServletRequest request,
												 HttpServletResponse response) {
		logger.info("加载toPrjInvestRptPage 页面.");
		String prjId = request.getParameter("prjId");// 项目ID
		String detailFlag = request.getParameter("detailFlag");// 项目ID
		String cstRlCd = request.getParameter("cstRlCd");// 客户关系

		//********流程参数开始********//
		String preTaskIds = request.getParameter("preTaskIds");//流程上一个节点任务ID,多个以逗号分割.
		String pInstId = request.getParameter("pInstId");//流程实例ID
		//********流程参数结束********//
		List<KeyValueVO> genderCdList = this.cstBscInfoService
				.searchGenderCdList();
		List<KeyValueVO> rlCdList = this.prjBscInfoService.getRlCdList();
		CstBscInfoVO cstBscInfoVO = null;
		String cstType = "";
		Long cstId = null;
		if (StringUtils.isNotBlank(prjId)) {
			cstBscInfoVO = prjBscInfoService.getCstTypByPrjId(Long
					.valueOf(prjId));
			if (null != cstBscInfoVO) {
				cstType = cstBscInfoVO.getCstTypCd();
				cstId = cstBscInfoVO.getId();
			}
		}
		SysUlDatCfgQueryCondition qc = new SysUlDatCfgQueryCondition();
		// 查承租人照片配置信息
		if (cstType.equals(CustomerConstant.CST_TYP_CD_NP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_NP);
			qc.setCfgCdList(codeList);
		}
		if (cstType.equals(CustomerConstant.CST_TYP_CD_CORP)) {
			List<String> codeList = new ArrayList<String>();
			codeList.add(PrjBscInfoConstant.CODE_SURVEY_PHOTO_LP);
			qc.setCfgCdList(codeList);
		}
		String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		PrjBscInfoVO prjBsc = this.prjBscInfoService.selectById(Long
				.valueOf(prjId));
		if (null != prjBsc) {
			orgCd = prjBsc.getBuOrgCd();
		}
		PrjCstInvestRptVO rpt = null;
		if (StringUtils.isNotBlank(prjId) && null != cstId) {
			rpt = this.prjCstInvestRptService
					.getPrjCstInvestRptByPrjIdAndCstId(Long.valueOf(prjId),
							cstId, cstRlCd);// 通过项目和客户id查询客户调查报告
		}
		// String orgCd = PrjBscInfoConstant.CODE_PRJ_FILE_DEF_ORG;
		qc.setOrgCd(orgCd);
		qc.setSysCd(CurrentThreadContext.getCurrentSysCd());
		List<SysUlDatCfgVO> list = sysUlDatCfgService.searchList(qc);
		SysUlDatCfgVO cfg = null;
		if (CollectionUtils.isNotEmpty(list)) {
			cfg = list.get(0);
		}
		List<SysUlDatCfgDtlVO> dtlList = cfg.getSysUlDatCfgDtlVOList();
		List<SysUlFilesRecVO> dtlFileList = new ArrayList<SysUlFilesRecVO>();
		if (CollectionUtils.isNotEmpty(dtlList)) {
			for (SysUlDatCfgDtlVO sysUlDatCfgDtlVO : dtlList) {
				SysUlFilesRecQueryCondition ulFileQc = new SysUlFilesRecQueryCondition();
				ulFileQc.setCfgCd(qc.getCfgCdList().get(0));
				ulFileQc.setSysCd(qc.getSysCd());
				ulFileQc.setOrgCd(orgCd);
				ulFileQc.setPkId(prjId);
				ulFileQc.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
				ulFileQc.setTabNm("PRJ_BSC_INFO");
				List<SysUlFilesRecVO> fileList = sysUlFilesRecService
						.searchList(ulFileQc);
				if (CollectionUtils.isNotEmpty(fileList)) {
					// sysUlDatCfgDtlVO.setFileRecList(fileList);
					for (SysUlFilesRecVO sysUlFilesRecVO : fileList) {
						sysUlFilesRecVO.setCfgCd(qc.getCfgCdList().get(0));
						sysUlFilesRecVO.setSysCd(sysUlDatCfgDtlVO.getSysCd());
						sysUlFilesRecVO.setOrgCd(sysUlDatCfgDtlVO.getOrgCd());
						sysUlFilesRecVO.setCfgDtlCd(sysUlDatCfgDtlVO
								.getCfgDtlCd());
						sysUlFilesRecVO.setDatNm(sysUlDatCfgDtlVO.getDatNm());
						dtlFileList.add(sysUlFilesRecVO);
					}
				} else {
					SysUlFilesRecVO filesRecVO = new SysUlFilesRecVO();
					filesRecVO.setCfgCd(qc.getCfgCdList().get(0));
					filesRecVO.setSysCd(sysUlDatCfgDtlVO.getSysCd());
					filesRecVO.setOrgCd(sysUlDatCfgDtlVO.getOrgCd());
					filesRecVO.setCfgDtlCd(sysUlDatCfgDtlVO.getCfgDtlCd());
					filesRecVO.setDatNm(sysUlDatCfgDtlVO.getDatNm());
					dtlFileList.add(filesRecVO);
				}
			}
			//
		}
		String serverPath = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_SERVER_PATH);// 服务地址
		String customerPah = PropertiesCacheUtils
				.getProperty(UploadConstant.UPLOAD_COSTOMER_PATH);
		String headPic = PropertiesCacheUtils
				.getProperty(fl.constant.facade.framework.constant.UploadConstant.DEFAULT_NO_PIC);
		// 客户类型
		ModelAndView view = new ModelAndView(
				"project/prjcstinvestrptinfo/prjCstInvestRptInfoSystemAdd");
		view.addObject("genderCdList", JSON.toJSONString(genderCdList));
		view.addObject("rlCdList", JSON.toJSONString(rlCdList));
		view.addObject("prjId", prjId);
		view.addObject("detailFlag", detailFlag);
		view.addObject("cstRlCd", cstRlCd);
		view.addObject("dtlList", dtlFileList);
		view.addObject("defImg", serverPath + customerPah + headPic);
		view.addObject("cstType", cstType);
		view.addObject("cstId", cstId);
		view.addObject("pInstId", pInstId);
		view.addObject("preTaskIds", preTaskIds);
		view.addObject("prjCstInvestRpt", rpt);
		return view;
	}

    @RequestMapping(value = "/toMfrPrjBscInfoDetailList.do", method = {RequestMethod.GET})
    public ModelAndView toMfrPrjBscInfoDetailList(HttpServletRequest request, HttpServletResponse response) {
        String accId = request.getParameter("accId");
        ModelAndView view = new ModelAndView("project/prjbscinfo/backAccPrjBscInfoDetailList");
        view.addObject("mfrPrjViewFlag", "mfrPrjViewFlag");
        view.addObject("accId", accId);
        logger.info("toMfrPrjBscInfoDetailList,跳转到厂商项目详细列表accId:{},user:{}",accId, CurrentThreadContext.getCurrentUserName());
        return view;
    }

    /**
     * @Author huangkailun
     * @Date 下午2:45 2019/1/14
     * @Description 返利账号管理的相关项目列表
     * @Param
     * @return
     */
    @SuppressWarnings("unchecked")
    @RequestMapping(value = "/initMfrPrjList4BackAcc.do", method = {RequestMethod.GET})
    @ResponseBody
    public Object initMfrPrjList4BackAcc(HttpServletRequest request, HttpServletResponse response) {

        String accId = request.getParameter("accId");

        PrjSplBankAccRQueryCondition prjSplBankAccRQueryCondition = new PrjSplBankAccRQueryCondition();
        prjSplBankAccRQueryCondition.setSplAccNoId(Long.parseLong(accId));

        // 获取该厂商下的所有项目产品
        List<PrjSplBankAccRVO> prjSplBankAccRVOList = prjSplBankAccRService.searchList(prjSplBankAccRQueryCondition);
        if (CollectionUtils.isEmpty(prjSplBankAccRVOList)) {
            return new ListPageVO<PrjBscInfoVO>();
        }
        // 获取产品ids
        List<Long> prdIds = new ArrayList<>();
        for (PrjSplBankAccRVO prjSplBankAccRVO : prjSplBankAccRVOList) {
            if (!prdIds.contains(prjSplBankAccRVO.getPrjPrdId())) {
                prdIds.add(prjSplBankAccRVO.getPrjPrdId());
            }
        }
        PrjPrdBscInfoQueryCondition prjPrdBscInfoQueryCondition = new PrjPrdBscInfoQueryCondition();
        prjPrdBscInfoQueryCondition.setIdList(prdIds);
        List<PrjPrdBscInfoVO> prjPrdBscInfoVOList = prjPrdBscInfoService.searchList(prjPrdBscInfoQueryCondition);

        List<Long> prjIds = new ArrayList<>();
        for (PrjPrdBscInfoVO prjPrdBscInfoVO : prjPrdBscInfoVOList) {
            if (!prjIds.contains(prjPrdBscInfoVO.getPrjId())) {
                prjIds.add(prjPrdBscInfoVO.getPrjId());
            }
        }


        String currentPage = request.getParameter("page");
        String pageSize = request.getParameter("pagesize");
        String prjNm = request.getParameter("prjNm");
        String cstNm = request.getParameter("cstNm");
        String prjTyCd = request.getParameter("prjTypCd");
        String bizTypCd = request.getParameter("bizTypCd");
        String prjStsCd = request.getParameter("prjStsCd");
        String buOrgCd = request.getParameter("buOrgCd");// 事业部
        String cstId = request.getParameter("cstId");// 客户ID
        String splId = request.getParameter("splId");// 供应商ID(YAOXIURONG)
        String lsCntNo = request.getParameter("lsCntNo");
        String lnkCompId = request.getParameter("lnkCompId");// 挂靠公司ID
        String cstMgrNm = request.getParameter("cstMgrNm");// 客户经理
        String cntTypCd = request.getParameter("cntTypCd");
        String isDel = request.getParameter("isDel");//是否删除
        String cstMgrOrgCd = request.getParameter("cstMgrOrgCd");
        String userNm = request.getParameter("userNm");
        String ovdViewFlag = request.getParameter("ovdViewFlag");
        String cstMgrId = request.getParameter("cstMgrId");
        String insCode = request.getParameter("insCode");
        String fundRasInsId = request.getParameter("fundRasInsId");
        String stDt = request.getParameter("stDt");
        String endDt = request.getParameter("endDt");
        Pager page = new Pager();

        if (StringUtils.isNotEmpty(currentPage)) {
            page.setCurrentPage(Integer.parseInt(currentPage));
        }
        if (StringUtils.isNotEmpty(currentPage)) {
            page.setEveryPage(Integer.parseInt(pageSize));
        }

        PrjBscInfoQueryCondition prjBscInfoQueryCondition = new PrjBscInfoQueryCondition();
        if (CollectionUtils.isNotEmpty(prjIds)) {
            prjBscInfoQueryCondition.setIdList(prjIds);
        }
        if (StringUtils.isNotBlank(stDt)) {
            prjBscInfoQueryCondition.setStDt(DateUtils.formatStringToDate(stDt, DateUtils.YYYY_MM_DD));
        }
        if (StringUtils.isNotBlank(endDt)) {
            prjBscInfoQueryCondition.setEndDt(DateUtils.formatStringToDate(endDt, DateUtils.YYYY_MM_DD));
        }
        if (StringUtils.isNotBlank(fundRasInsId)) {
            prjBscInfoQueryCondition.setFundRasInsId(Long.valueOf(fundRasInsId));
        }
        if (StringUtils.isNotBlank(insCode)) {
            prjBscInfoQueryCondition.setInsCode(insCode);
        }
        if (StringUtils.isNotBlank(cstMgrOrgCd)) {
            prjBscInfoQueryCondition.setCstMgrOrgCd(cstMgrOrgCd);
        }
        if (StringUtils.isNotBlank(buOrgCd)) {
            prjBscInfoQueryCondition.setBuOrgCd(buOrgCd);
        }
        if (StringUtils.isNotBlank(isDel)) {
            prjBscInfoQueryCondition.setIsDel(Integer.valueOf(isDel));
        }
        if (StringUtils.isNotBlank(lsCntNo)) {
            prjBscInfoQueryCondition.setLsCntNo(lsCntNo);
        }
        if (StringUtils.isNotBlank(cntTypCd)) {
            prjBscInfoQueryCondition.setCntTypCd(cntTypCd);
        }
        if (StringUtils.isNotBlank(cstMgrNm)) {
            prjBscInfoQueryCondition.setCstMgrNm(cstMgrNm);
        }
        if (StringUtils.isNotBlank(lnkCompId)) {
            prjBscInfoQueryCondition.setCompLnkId(Long.valueOf(lnkCompId));
        }
        if (StringUtils.isNotBlank(prjNm)) {
            prjBscInfoQueryCondition.setPrjNm(prjNm);
        }
        if (StringUtils.isNotBlank(cstNm)) {
            prjBscInfoQueryCondition.setCstNm(cstNm);
        }
        if (StringUtils.isNotBlank(prjTyCd)) {
            prjBscInfoQueryCondition.setPrjTypCd(prjTyCd);
        }
        if (StringUtils.isNotBlank(bizTypCd)) {
            prjBscInfoQueryCondition.setBizTypCd(bizTypCd);
        }
        if (StringUtils.isNotBlank(prjStsCd)) {
            if (prjStsCd.equals(FlowConstant.FLOW_CHECK_STATE_NON)) {
                prjBscInfoQueryCondition.setDefPrjStsCd(prjStsCd);
            } else {
                prjBscInfoQueryCondition.setPrjStsCd(prjStsCd);
            }
            prjBscInfoQueryCondition.setSysCd(CurrentThreadContext.getCurrentSysCd());
        }
        if (StringUtils.isNotEmpty(cstId) && StringUtils.isNumeric(cstId)) {
            List<Long> cstIdList = new ArrayList<>();
            cstIdList.add(Long.valueOf(cstId));
            prjBscInfoQueryCondition.setCstIdList(cstIdList);
        }
        if (StringUtils.isNotEmpty(splId) && StringUtils.isNumeric(splId)) {
            prjBscInfoQueryCondition.setSplId(Long.valueOf(splId));// YAOXIURONG
        }
        if (StringUtils.isNotEmpty(userNm)) {
            prjBscInfoQueryCondition.setUserNm(userNm);
        }
        prjBscInfoQueryCondition.setUsrId(CurrentThreadContext.getCurrentUserId());
        prjBscInfoQueryCondition.setSysCd(CurrentThreadContext.getCurrentSysCd());
        if (StringUtils.isNotEmpty(cstMgrId)) {
            prjBscInfoQueryCondition.setCstMgrId(Long.parseLong(cstMgrId));
        }
        page.setCondition(prjBscInfoQueryCondition);
        Pager pager = this.prjBscInfoService.searchListPage(page);
        List<PrjBscInfoVO> list = (List<PrjBscInfoVO>) pager.getResultList();
        if (CollectionUtils.isNotEmpty(list) && "ovdViewFlag".equals(ovdViewFlag)) {
            this.prjBscInfoService.putOvdDataToPrjBscInfo(list);
        }
        ListPageVO<PrjBscInfoVO> listPage = new ListPageVO<PrjBscInfoVO>(list,
                pager.getTotalCount());
        return listPage;

    }

     /**
      * @Author huangkailun
      * @Date 上午11:13 2019/1/28
      * @Description 在发起项目评审流程的同时，需同时发起供应商账号、供应商返利账号、销售返利账号的流程，此方法就是获取账号状态以及发送流程的参数
      * @Param
      * @return
      */
    @RequestMapping(value = "/queryAccStsAndGetFlowParams.do", method = {RequestMethod.GET, RequestMethod.POST})
	@ResponseBody
    public Object queryAccStsAndGetFlowParams(HttpServletRequest request) throws BaseException {
		DataResultVO dataResult = new DataResultVO();
    	String prjId = request.getParameter("prjId");
    	logger.info("queryAccStsAndGetFlowParams,项目id==" + prjId);
		// 先查出项目下的产品
		PrjPrdBscInfoQueryCondition prjPrdBscInfoQueryCondition = new PrjPrdBscInfoQueryCondition();
		prjPrdBscInfoQueryCondition.setPrjId(Long.valueOf(prjId));
		List<PrjPrdBscInfoVO> prjPrdBscInfoVOList = prjPrdBscInfoService.searchList(prjPrdBscInfoQueryCondition);
		List<Long> prdIds = new ArrayList<>();
		if (CollectionUtils.isNotEmpty(prjPrdBscInfoVOList)) {
			for (PrjPrdBscInfoVO prjPrdBscInfoVO : prjPrdBscInfoVOList) {
				prdIds.add(prjPrdBscInfoVO.getId());
			}
		}else{
			logger.error("项目对应的产品信息不存在，prjId={}",prjId);
			throw new BaseException(LogExceptionEnum.COMMON_CODE_0001.getCode(),"项目对应的产品信息不存在");
		}

		//城配业务-项目发起的时候  查询其合格证信息、发票、GPS信息是否存在：1.如果不存在 不处理  2.如果存在 修改状态为处理中
		PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(prjId));
		logger.info("queryAccStsAndGetFlowParams,立项流程-项目查询信息结果-项目ID：" + prjId);
		String prjTypCd = prjBscInfoVO.getPrjTypCd();
		if (StringUtils.isNotBlank(prjTypCd) && prjTypCd.equals(PrjBscInfoConstant.PRJ_TYP_CD_CPYW)){
			logger.info("queryAccStsAndGetFlowParams,立项流程-城配业务-合格证/发票/GPS信息审核状态变更开始-项目ID：" + prjId);
			PrjPrdDtlQueryCondition prjPrdDtlQueryCondition = new PrjPrdDtlQueryCondition();
			prjPrdDtlQueryCondition.setPrjId(Long.valueOf(prjId));
			List<PrjPrdDtlVO> prjPrdDtlVOList = this.prjPrdDtlService.selectList(prjPrdDtlQueryCondition);
			logger.info("queryAccStsAndGetFlowParams,立项流程-城配业务-合格证/发票/GPS信息审核状态变更-项目ID：" + prjId + "-项目产品明细：" + JSON.toJSONString(prjPrdDtlVOList));
			if(CollectionUtils.isNotEmpty(prjPrdDtlVOList)){
				for(PrjPrdDtlVO prjPrdDtlVO : prjPrdDtlVOList){
					Long dtlId = prjPrdDtlVO.getId();
					Long actPrdId = prjPrdDtlVO.getActPrdId();
					if(prjPrdDtlVO.getActPrdId() != null){
						Boolean rt = this.prjPrdVehInfoService.modifyPrjPrdVehAudStsCdByDtlId(dtlId,FlowConstant.FLOW_CHECK_STATE_IN);
						logger.info("queryAccStsAndGetFlowParams,立项流程-城配业务-合格证信息审核状态变更-项目ID：" + prjId + "-结果：" + rt);
					}
					PrjPrdDtlGpsQueryCondition prjPrdDtlGpsQC = new PrjPrdDtlGpsQueryCondition();
					prjPrdDtlGpsQC.setPrjDtlId(dtlId);
					prjPrdDtlGpsQC.setSerialNo(BaseConstant.IS_YESNO_YES);
					List<PrjPrdDtlGpsVO> prjPrdDtlGpsVOS = this.prjPrdDtlGpsService.searchList(prjPrdDtlGpsQC);
					if(CollectionUtils.isNotEmpty(prjPrdDtlGpsVOS)){
						PrjPrdDtlGpsVO prjPrdDtlGpsVO = new PrjPrdDtlGpsVO();
						prjPrdDtlGpsVO.setId(prjPrdDtlGpsVOS.get(0).getId());
						prjPrdDtlGpsVO.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_IN);
						Boolean rt = this.prjPrdDtlGpsService.modify(prjPrdDtlGpsVO);
						logger.info("queryAccStsAndGetFlowParams,立项流程-城配业务-GPS信息审核状态变更-项目ID：" + prjId + "-结果：" + rt);
					}

					//修改发票状态为审核中
					logger.info("isModify,发起放款流程成功后修改发票状态请求参数是 prjId="+prjPrdDtlVO.getPrjId()+" paySchNo="+prjPrdDtlVO.getPaySchNo());
					boolean flag = prjPrdInvoiceService.modifyAudStsByPrjIdAndPaySchNo(prjPrdDtlVO.getPrjId().toString(),prjPrdDtlVO.getPaySchNo(),FlowConstant.FLOW_CHECK_STATE_IN);
					logger.info("isModify,发起放款流程成功后修改发票状态返回结果是"+flag);
//					PrjPrdInvoiceQueryCondition invoiceQueryCondition = new PrjPrdInvoiceQueryCondition();
//					invoiceQueryCondition.setPrjId(prjPrdDtlVO.getPrjId().toString());
//					invoiceQueryCondition.setPaySchNo(prjPrdDtlVO.getPaySchNo());
//					List<PrjPrdInvoiceVO> prjPrdInvoiceList = prjPrdInvoiceService.searchPrjPrdInvoiceList(invoiceQueryCondition);
//					if (CollectionUtils.isNotEmpty(prjPrdInvoiceList)) {
//						for (PrjPrdInvoiceVO prjPrdInvoiceVO : prjPrdInvoiceList) {
//							prjPrdInvoiceVO.setAudStsCd(FlowConstant.FLOW_CHECK_STATE_IN);
//							logger.info("isModify,发起放款流程成功后修改发票状态请求参数是"+JSON.toJSONString(prjPrdInvoiceVO));
//							prjPrdInvoiceService.modify(prjPrdInvoiceVO);
//							logger.info("isModify,发起放款流程成功后修改发票状态返回结果是"+JSON.toJSONString(prjPrdInvoiceVO));
//						}
//					}
				}
			}
			logger.info("queryAccStsAndGetFlowParams,城配业务-合格证/GPS信息审核状态变更结束-项目ID：" + prjId);
		}

		// 查询项目产品和供应商、供应商返利、销售返利的关联表集合（1：供应商账号、2：供应商返利账号、11：销售返利账号）
		PrjSplBankAccRQueryCondition prjSplBankAccRQueryCondition = new PrjSplBankAccRQueryCondition();
		prjSplBankAccRQueryCondition.setPrjPrdIds(prdIds);
		prjSplBankAccRQueryCondition.setIsDel(BaseConstant.IS_YESNO_NO);
		List<PrjSplBankAccRVO> prjSplBankAccRVOList = prjSplBankAccRService.searchList(prjSplBankAccRQueryCondition);

		// 供应商账号id
		Long splAccId = null;
		// 供应商返利账号id
		Long splBackAccId = null;
		// 销售返利账号id
		Long saleBackAccId = null;
		if (CollectionUtils.isNotEmpty(prjSplBankAccRVOList)) {
			for (PrjSplBankAccRVO prjSplBankAccRVO : prjSplBankAccRVOList) {
				if (PrjPrdBscInfoConstant.SPL_BANK_NO_TP.equals(prjSplBankAccRVO.getPurpCd())) {
					String receiveTypeCd = prjSplBankAccRVO.getReceiveTypeCd();
					if(!(StringUtils.isNotBlank(receiveTypeCd) && (receiveTypeCd.equals(CapitalConstant.CODE_PAYEE_TYP_CD_8) || receiveTypeCd.equals(CapitalConstant.CODE_PAYEE_TYP_CD_2)))){
						// 供应商账号
						splAccId = prjSplBankAccRVO.getSplAccNoId();
						logger.info("queryAccStsAndGetFlowParams,供应商账号id==" + splAccId);
					}
				} else if (PrjPrdBscInfoConstant.SPL_BACK_BANK_NO_TYP.equals(prjSplBankAccRVO.getPurpCd())) {
					// 供应商返利账号
					splBackAccId = prjSplBankAccRVO.getSplAccNoId();
					logger.info("queryAccStsAndGetFlowParams,供应商返利账号id==" + splBackAccId);
				} else if (PrjPrdBscInfoConstant.SAL_BACK_BANK_NO_TYP.equals(prjSplBankAccRVO.getPurpCd())) {
					// 销售返利账号
					saleBackAccId = prjSplBankAccRVO.getSplAccNoId();
					logger.info("queryAccStsAndGetFlowParams,销售返利账号id==" + saleBackAccId);
				}
			}
		}
		// 供应商账号的状态
		String splAccAudSts = null;
		if (StringUtils.isNotEmpty(splAccId)) {
			SplBankVO splAccVO = splBankService.selectById(splAccId);
			splAccAudSts = splAccVO.getAudStsCd();
		}
		// 供应商返利账号的状态
		String splBackAccAudSts = null;
		if (StringUtils.isNotEmpty(splBackAccId)) {
			SplBankVO splBackAccVO = splBankService.selectById(splBackAccId);
			splBackAccAudSts = splBackAccVO.getAudStsCd();
		}
		// 返利账号的状态
		String saleRebAccInfoAudSts = null;
		if (StringUtils.isNotEmpty(saleBackAccId)) {
			SaleRebAccInfoVO saleRebAccInfoVO = saleRebAccInfoService.selectById(saleBackAccId);
			saleRebAccInfoAudSts = saleRebAccInfoVO.getAudStsCd();
		}
		JSONObject json = new JSONObject();
		if (StringUtils.isNotEmpty(splAccAudSts)) {
			// 获取供应商账号发起流程的参数
			if (FlowInfoConstant.FLOW_READY.equals(splAccAudSts) || FlowInfoConstant.FLOW_FAIL.equals(splAccAudSts)) {
				SysFlowManageVQueryCondition condition = new SysFlowManageVQueryCondition();
				condition.setIsDel(BaseConstant.IS_YESNO_NO);
				condition.setIsValid(BaseConstant.IS_YESNO_YES);
				condition.setModelTyp(FlowStartRelInfoCfgEnum.FLOW_SPL_ACC.getModelTyp());
				condition.setSysCd(CurrentThreadContext.getCurrentSysCd());
				condition.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
				List<SysFlowManageVDTO> list = this.flowApiService.searchFlowManageVListForStart(condition);
				if (CollectionUtils.isNotEmpty(list)) {
					SysFlowManageVDTO sysFlowManageVDTO = list.get(0);
					// 供应商账号需要发起流程
					json.put("splFlow", "spl");
					json.put("splId", splAccId);
					json.put("splModelTyp", FlowStartRelInfoCfgEnum.FLOW_SPL_ACC.getModelTyp());
					json.put("splProcDefKey", sysFlowManageVDTO.getProcDefKey());
					json.put("splProcDefId", sysFlowManageVDTO.getProcDefId());
					json.put("splProcNo", sysFlowManageVDTO.getProcNo());
					dataResult.setSuccess(BaseConstant.IS_YESNO_YES);
				}
			}
		}
		if (StringUtils.isNotEmpty(splBackAccAudSts)) {
			// 获取供应商返利账号发起流程的参数
			if (FlowInfoConstant.FLOW_READY.equals(splBackAccAudSts) || FlowInfoConstant.FLOW_FAIL.equals(splBackAccAudSts)) {
				SysFlowManageVQueryCondition condition = new SysFlowManageVQueryCondition();
				condition.setIsDel(BaseConstant.IS_YESNO_NO);
				condition.setIsValid(BaseConstant.IS_YESNO_YES);
				condition.setModelTyp(FlowStartRelInfoCfgEnum.FLOW_SPL_ACC.getModelTyp());
				condition.setSysCd(CurrentThreadContext.getCurrentSysCd());
				condition.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
				List<SysFlowManageVDTO> list = this.flowApiService.searchFlowManageVListForStart(condition);
				if (CollectionUtils.isNotEmpty(list)) {
					SysFlowManageVDTO sysFlowManageVDTO = list.get(0);
					// 供应商账号需要发起流程
					json.put("splBackFlow", "splBack");
					json.put("splBackId", splBackAccId);
					json.put("splBackModelTyp", FlowStartRelInfoCfgEnum.FLOW_SPL_ACC.getModelTyp());
					json.put("splBackProcDefKey", sysFlowManageVDTO.getProcDefKey());
					json.put("splBackProcDefId", sysFlowManageVDTO.getProcDefId());
					json.put("splBackProcNo", sysFlowManageVDTO.getProcNo());
					dataResult.setSuccess(BaseConstant.IS_YESNO_YES);
				}
			}
		}
		if (StringUtils.isNotEmpty(saleRebAccInfoAudSts)) {
			// 获取销售返利账号发起流程的参数
			if (FlowInfoConstant.FLOW_READY.equals(saleRebAccInfoAudSts) || FlowInfoConstant.FLOW_FAIL.equals(saleRebAccInfoAudSts)) {
				SysFlowManageVQueryCondition condition = new SysFlowManageVQueryCondition();
				condition.setIsDel(BaseConstant.IS_YESNO_NO);
				condition.setIsValid(BaseConstant.IS_YESNO_YES);
				condition.setModelTyp(FlowStartRelInfoCfgEnum.FLOW_SALE_REB_ACC.getModelTyp());
				condition.setSysCd(CurrentThreadContext.getCurrentSysCd());
				condition.setOrgCd(CurrentThreadContext.getCurrentOrgCd());
				List<SysFlowManageVDTO> list = this.flowApiService.searchFlowManageVListForStart(condition);
				if (CollectionUtils.isNotEmpty(list)) {
					SysFlowManageVDTO sysFlowManageVDTO = list.get(0);
					// 供应商账号需要发起流程
					json.put("saleRebAccFlow", "saleRebAcc");
					json.put("saleRebAccId", saleBackAccId);
					json.put("saleRebAccModelTyp", FlowStartRelInfoCfgEnum.FLOW_SALE_REB_ACC.getModelTyp());
					json.put("saleRebAccProcDefKey", sysFlowManageVDTO.getProcDefKey());
					json.put("saleRebAccProcDefId", sysFlowManageVDTO.getProcDefId());
					json.put("saleRebAccProcNo", sysFlowManageVDTO.getProcNo());
					dataResult.setSuccess(BaseConstant.IS_YESNO_YES);
				}
			}
		}
        logger.info("queryAccStsAndGetFlowParams,获取的需要发起的账号流程的参数==" + json.toJSONString());
        dataResult.setData(json);
		return dataResult;
	}


	@RequestMapping(value = "/createPdf.do", method = { RequestMethod.GET , RequestMethod.POST})
	@ResponseBody
	public Object createPdf(HttpServletResponse response,HttpServletRequest request) throws BaseException{
		String file_path="";
		String id = request.getParameter("id");
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "操作成功!");
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("主键id不能为空!");
			logger.info("getById,获取数据,主键id不存在.[id="+id+"]，user:{}", CurrentThreadContext.getCurrentUserName());
			return result;
		}
		PrjPrdPaySchMVO prjPrdPaySchMVO = this.prjPrdPaySchMService.selectById(Long.valueOf(id));
		logger.info("获取项目产品支付表相关信息prjPrdPaySchMVO=" + JSONObject.toJSONString(prjPrdPaySchMVO));
		if (null == prjPrdPaySchMVO || StringUtils.isEmpty(prjPrdPaySchMVO.getPaySchNo()) || StringUtils.isEmpty(prjPrdPaySchMVO.getPrjId())){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("项目产品支付表相关信息不能为空!");
			return result;
		}
		List<VehSrcInfDTO> vehSrcInfList = null;
		VehSrcInfDTO vehSrcInfDTO = null;
		PrjPrdDtlQueryCondition prjPrdDtlQc = new PrjPrdDtlQueryCondition();
		prjPrdDtlQc.setPrjId(prjPrdPaySchMVO.getPrjId());
		prjPrdDtlQc.setPaySchNo(prjPrdPaySchMVO.getPaySchNo());
		logger.info("获取项目产品明细相关信息入参prjPrdDtlQc=" + JSONObject.toJSONString(prjPrdDtlQc));
		List<PrjPrdDtlVO> prjPrdDtlVOList = this.prjPrdDtlService.selectList(prjPrdDtlQc);
		logger.info("获取项目产品明细相关信息prjPrdDtlVOList=" + JSONObject.toJSONString(prjPrdDtlVOList));
		if (CollectionUtils.isNotEmpty(prjPrdDtlVOList)){
			PrjPrdDtlVO prjPrdDtlVO = prjPrdDtlVOList.get(0);
			PrjPrdVehInfoVO vehVO = this.prjPrdVehInfoService.selectById(prjPrdDtlVO.getActPrdId());
			logger.info("获取合格相关信息vehVO=" + JSONObject.toJSONString(vehVO));
			if (null == vehVO){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("合格信息为空!");
				return result;
			}
			VehSrcInfQC qc = new VehSrcInfQC();
			qc.setDetectionState(3l);
			qc.setVin(vehVO.getVin());
			logger.info("获取车源相关信息入参qc=" + JSONObject.toJSONString(qc));
			vehSrcInfList = vehSrcInfQueryApiService.searchVehSrcInfDTOList(qc);
			logger.info("获取车源相关信息vehSrcInfList=" + JSONObject.toJSONString(vehSrcInfList));
			if(CollectionUtils.isNotEmpty(vehSrcInfList)){
				vehSrcInfDTO = vehSrcInfList.get(0);
			}
		}

		try {
			Map<String, Object> map = new HashMap<String, Object>();
			String successPath = request.getSession().getServletContext().getRealPath("/images/success.png");
			String warningPath = request.getSession().getServletContext().getRealPath("/images/warning.png");
			String noBurnPath = request.getSession().getServletContext().getRealPath("/images/noBurn.png");
			String huoyan360 = request.getSession().getServletContext().getRealPath("/images/huoyan360.png");
			map.put("successPath", successPath);//通过图片地址
			map.put("warningPath", warningPath);//不通过图片地址
			map.put("noBurnPath", noBurnPath);//印章图片地址
			map.put("huoyan360", huoyan360);//logo图片地址

			if (null == vehSrcInfDTO){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("获取车源相关信息为空!");
				return result;
			}
			PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(prjPrdPaySchMVO.getPrjId());
			logger.info("获取项目相关信息prjBscInfoVO=" + JSONObject.toJSONString(prjBscInfoVO));
			if (null == prjBscInfoVO){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("项目相关信息不能为空!");
				return result;
			}
			String businessType = PrjBscInfoConstant.getBusinessTypeMap.get(prjBscInfoVO.getBuOrgCd()+prjBscInfoVO.getPrjTypCd());
			logger.info("获取二手车检测报告数据入参id=" + vehSrcInfDTO.getId() + ",vehSrcInfDTO=" + JSONObject.toJSONString(vehSrcInfDTO) + ",businessType=" + businessType);
			DataResultDTO dataResultDTO = this.sendRecDataApiService.acquiringPdfDetectionData(vehSrcInfDTO.getId().toString(),"2019050617425055095", Long.valueOf(businessType));
			logger.info("dataResultDTO,二手车检测报告数据" + JSONObject.toJSONString(dataResultDTO));
			if (null == dataResultDTO || null == dataResultDTO.getData()){
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("获取二手车检测报告数据为空!");
				return result;
			}
			Map<String, Object> map2 = (Map<String, Object>) dataResultDTO.getData();
            map2.putAll(map);
            logger.info("map2，检测报告数据:{}", JSONObject.toJSONString(map2));

			PrjQuatPrpsQueryCondition prjQuatQC = new PrjQuatPrpsQueryCondition();
			prjQuatQC.setPrjId(prjPrdPaySchMVO.getPrjId());
			prjQuatQC.setPrpsTypCd("1");
			prjQuatQC.setIsDel(0);
			List<PrjQuatPrpsVO> quatList = this.prjQuatPrpsService.searchList(prjQuatQC);
			PrjQuatPrpsVO prpsVO = null;
			if(CollectionUtils.isNotEmpty(quatList)){
				prpsVO = quatList.get(0);
			}
			PrjQuatPrpsFeeQueryCondition prjQuatPrpsFeeQc = new PrjQuatPrpsFeeQueryCondition();
			prjQuatPrpsFeeQc.setPrpsId(prpsVO.getId());
			List<PrjQuatPrpsFeeVO> feeList = this.prjQuatPrpsFeeService.searchList(prjQuatPrpsFeeQc);
			Double caijfbl = null;
			if(CollectionUtils.isNotEmpty(feeList)){
				for (PrjQuatPrpsFeeVO prjQuatPrpsFeeVO : feeList) {
					if(prjQuatPrpsFeeVO.getFeeTypCd().equals(PrjQuatPrpsFeeConstant.FEE_TYP_CD_74)){
						caijfbl = prjQuatPrpsFeeVO.getFeePct();
					}
                }
            }
			logger.info("车检费计算比例：" + caijfbl);
			if(null != caijfbl){
				if(caijfbl <= 6){
					//请求pdf生成，返回生成成功后的地址
					file_path = this.generatePdf(map2,request);//简化版
				}else {
					//请求pdf生成，返回生成成功后的地址
					file_path = this.generatePdf2(map2,request);//完整版
				}
			}
			logger.info("二手车检测报告地址：" + file_path);
            if(StringUtils.isNotEmpty(file_path)) {
                String pathArray = file_path.replaceAll(PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_ROOT_PATH),"");
                result.setData(PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_SERVER_PATH) + pathArray);
                result.setSuccess(BaseConstant.IS_YESNO_YES);
            }else {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("生成检测报告失败!");
				return result;
			}
			logger.info("生成二手车检测报告最终结果：" + JSONObject.toJSONString(result));
           /* //图片生成之后删除
            if(map.get("FuturePath")!=null){
                new File(map.get("FuturePath").toString()).delete();//删除原先的图片
            }
            if(map.get("HistoryPath")!=null){
                new File(map.get("HistoryPath").toString()).delete();//删除原先的图片
            }*/

		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("createPdf,pdf生成["+id+"].user:{},msg:{}", CurrentThreadContext.getCurrentUserName(),ex.getMessage());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("系统错误,请联系管理员!");
			logger.error("createPdf,pdf生成失败["+id+"].user:{},msg:{}", CurrentThreadContext.getCurrentUserName(),ex.getMessage());
		}
		return result;
	}



	@RequestMapping(value = "/createPdfNewCar.do", method = { RequestMethod.GET , RequestMethod.POST})
	@ResponseBody
	public Object createPdfNewCar(HttpServletResponse response,HttpServletRequest request) throws BaseException{
		String file_path="";
		String id = request.getParameter("id");//支付表id
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "操作成功!");
		if(StringUtils.isEmpty(id)){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("主键id不能为空!");
			logger.info("getById,获取数据,主键id不存在.[id="+id+"].user:{}", CurrentThreadContext.getCurrentUserName());
			return result;
		}

		PrjPrdDtlVO prdDtlVO = null;
		PrjPrdDtlQueryCondition prjPrdDtlQc = new PrjPrdDtlQueryCondition();
		prjPrdDtlQc.setPaySchId(Long.valueOf(id));
		List<PrjPrdDtlVO> listDtl = this.prjPrdDtlService.selectList(prjPrdDtlQc);
		if(CollectionUtils.isNotEmpty(listDtl)){
			prdDtlVO = listDtl.get(0);
		}
		logger.info("获取项目产品明细相关信息：" + JSONObject.toJSONString(prdDtlVO));
		if (null == prdDtlVO){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("项目产品明细相关信息不能为空!");
			return result;
		}
		PrjPrdBscInfoVO prjPrdBscInfoVO = this.prjPrdBscInfoService.selectById(prdDtlVO.getPrjPrdId());
		logger.info("获取项目产品相关信息：" + JSONObject.toJSONString(prjPrdBscInfoVO));
		if (null == prjPrdBscInfoVO){
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("项目产品相关信息不能为空!");
			return result;
		}
		try {
			Map<String, Object> map = new HashMap<String, Object>();
			String jiageimgPath = request.getSession().getServletContext().getRealPath("/images/jiageimg.png");
			map.put("jiageimgPath", jiageimgPath);//通过图片地址
			List<VechileParaConfDTO> vechileParaConfList = null;
			if (StringUtils.isNotEmpty(prjPrdBscInfoVO.getStyleId())){
				vechileParaConfList = cvmApiService.searchVehParaConfListById(prjPrdBscInfoVO.getStyleId(), WebBaseConstant.SYS_SYS_CD,WebBaseConstant.CHANNEL_CD);
			}
			logger.info("获取车型相关信息数据：" + JSONObject.toJSONString(vechileParaConfList));
			if(CollectionUtils.isNotEmpty(vechileParaConfList)){
				for(VechileParaConfDTO vechileParaConfDTO : vechileParaConfList){
					//车型名称
					if(("BASIC_STYLENAME").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("carName", vechileParaConfDTO.getParaConfValue());
						}
					}
					//车辆类型（车分类）
					if(("BASIC_CLASSIFICATION").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							Map<String, String> carTypCdMap = this.sysDictionaryApiService.searchGroupToMap("15000", "0000", DictionaryConstant.CODE_PRD_TYP_CD);
							if(carTypCdMap.containsKey(vechileParaConfDTO.getParaConfValue())){
								vechileParaConfDTO.setParaConfValue(carTypCdMap.get(vechileParaConfDTO.getParaConfValue()));
							}
							map.put("carType", vechileParaConfDTO.getParaConfValue());
						}
					}
					//公告型号
					if(("BASIC_BULLETIN").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("gongGXhao", vechileParaConfDTO.getParaConfValue());
						}
					}
					//驱动形式
					if(("BASIC_DIRVE").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							Map<String, String> carTypCdMap = this.sysDictionaryApiService.searchGroupToMap("15000", "0000", DictionaryConstant.CODE_PRD_QUDONG_CD);
							if(carTypCdMap.containsKey(vechileParaConfDTO.getParaConfValue())){
								vechileParaConfDTO.setParaConfValue(carTypCdMap.get(vechileParaConfDTO.getParaConfValue()));
							}
							map.put("quDXshi", vechileParaConfDTO.getParaConfValue());
						}
					}
					//吨位级别
					if(("BASIC_TONLEVEL").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							Map<String, String> carTypCdMap = this.sysDictionaryApiService.searchGroupToMap("15000", "0000", DictionaryConstant.CODE_PRD_DUWEI_CD);
							if(carTypCdMap.containsKey(vechileParaConfDTO.getParaConfValue())){
								vechileParaConfDTO.setParaConfValue(carTypCdMap.get(vechileParaConfDTO.getParaConfValue()));
							}
							map.put("duWjBie", vechileParaConfDTO.getParaConfValue());
						}
					}
					//变速箱品牌
					if(("GB_BRAND").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							Map<String, String> carTypCdMap = this.sysDictionaryApiService.searchGroupToMap("15000", "0000", DictionaryConstant.CODE_PRD_BSXPP_CD);
							if(carTypCdMap.containsKey(vechileParaConfDTO.getParaConfValue())){
								vechileParaConfDTO.setParaConfValue(carTypCdMap.get(vechileParaConfDTO.getParaConfValue()));
							}
							map.put("bianSuBp", vechileParaConfDTO.getParaConfValue());
						}
					}
					//换挡方式
					if(("GB_SHIFTMODE").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							Map<String, String> carTypCdMap = this.sysDictionaryApiService.searchGroupToMap("15000", "0000", DictionaryConstant.CODE_PRD_HUANDFS_CD);
							if(carTypCdMap.containsKey(vechileParaConfDTO.getParaConfValue())){
								vechileParaConfDTO.setParaConfValue(carTypCdMap.get(vechileParaConfDTO.getParaConfValue()));
							}
							map.put("huanDang", vechileParaConfDTO.getParaConfValue());
						}
					}
					//前进档位
					if(("GB_FGEAR").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							Map<String, String> carTypCdMap = this.sysDictionaryApiService.searchGroupToMap("15000", "0000", DictionaryConstant.CODE_PRD_QJDWEI_CD);
							if(carTypCdMap.containsKey(vechileParaConfDTO.getParaConfValue())){
								vechileParaConfDTO.setParaConfValue(carTypCdMap.get(vechileParaConfDTO.getParaConfValue()));
							}
							map.put("qianJDWei", vechileParaConfDTO.getParaConfValue());
						}
					}
					//座位排数
					if(("BASIC_NSEATS").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("zuoWPShu", vechileParaConfDTO.getParaConfValue());
						}
					}
					//发动机品牌
					if(("ENG_BRAND").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							Map<String, String> carTypCdMap = this.sysDictionaryApiService.searchGroupToMap("15000", "0000", DictionaryConstant.CODE_PRD_FADJPP_CD);
							if(carTypCdMap.containsKey(vechileParaConfDTO.getParaConfValue())){
								vechileParaConfDTO.setParaConfValue(carTypCdMap.get(vechileParaConfDTO.getParaConfValue()));
							}
							map.put("faDJPPai", vechileParaConfDTO.getParaConfValue());
						}
					}
					//发动机型号（发动机）
					if(("ENG_NAME").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("faDongJi", vechileParaConfDTO.getParaConfValue());
						}
					}
					//最大马力
					if(("ENG_HMAXPOWER").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("zdMaLi", vechileParaConfDTO.getParaConfValue());
						}
					}
					//气缸数
					if(("ENG_CYLINDERNUM").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("qiGangShu", vechileParaConfDTO.getParaConfValue());
						}
					}
					//燃料种类
					if(("ENG_FUELNAME").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							Map<String, String> carTypCdMap = this.sysDictionaryApiService.searchGroupToMap("15000", "0000", DictionaryConstant.CODE_PRD_RANLIAO_CD);
							if(carTypCdMap.containsKey(vechileParaConfDTO.getParaConfValue())){
								vechileParaConfDTO.setParaConfValue(carTypCdMap.get(vechileParaConfDTO.getParaConfValue()));
							}
							map.put("ranLiao", vechileParaConfDTO.getParaConfValue());
						}
					}
					//排放标准
					if(("ENG_EFFLUENT").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							Map<String, String> carTypCdMap = this.sysDictionaryApiService.searchGroupToMap("15000", "0000", DictionaryConstant.CODE_PRD_PAIFANGBZ_CD);
							if(carTypCdMap.containsKey(vechileParaConfDTO.getParaConfValue())){
								vechileParaConfDTO.setParaConfValue(carTypCdMap.get(vechileParaConfDTO.getParaConfValue()));
							}
							map.put("paiFangBz", vechileParaConfDTO.getParaConfValue());
						}
					}
					//后桥速比
					if(("UND_REARRATIO").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("houQSBi", vechileParaConfDTO.getParaConfValue());
						}
					}
					//货箱形式
					if(("CP_CONTFORM").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							Map<String, String> carTypCdMap = this.sysDictionaryApiService.searchGroupToMap("15000", "0000", DictionaryConstant.CODE_PRD_HOUXXS_CD);
							if(carTypCdMap.containsKey(vechileParaConfDTO.getParaConfValue())){
								vechileParaConfDTO.setParaConfValue(carTypCdMap.get(vechileParaConfDTO.getParaConfValue()));
							}
							map.put("huoXiangXS", vechileParaConfDTO.getParaConfValue());
						}
					}
					//上装内部尺寸（货厢长度）
					if(("CP_CONTLENGTH").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("huoXCLong", vechileParaConfDTO.getParaConfValue());
						}
					}
					//上装内部尺寸（货厢宽度）
					if(("CP_CONTWIDTH").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("huoXCWid", vechileParaConfDTO.getParaConfValue());
						}
					}
					//上装内部尺寸（货厢高度）
					if(("CP_CONTHEIGHT").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("huoXCHig", vechileParaConfDTO.getParaConfValue());
						}
					}
					//轮胎规格
					if(("TYRE_TYRESIZE").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("luTaiGuig", vechileParaConfDTO.getParaConfValue());
						}
					}
					//轮胎数
					if(("TYRE_TYRENUM").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("luTaiShu", vechileParaConfDTO.getParaConfValue());
						}
					}
					//额定载重
					if(("BASIC_LOADWEIGHT").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("eDZaiZhong", vechileParaConfDTO.getParaConfValue());
						}
					}
					//轴距
					if(("BASIC_WHEELBASE").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("youJu", vechileParaConfDTO.getParaConfValue());
						}
					}
					//牵引总质量
					if(("BASIC_TRACQUA").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("qianYiZzl", vechileParaConfDTO.getParaConfValue());
						}
					}
					//版本
					if(("BASIC_VERSION").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("banBen", vechileParaConfDTO.getParaConfValue());
						}
					}
					//最大功率
					if(("ENG_MAXPOWER").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("zDGONGLv", vechileParaConfDTO.getParaConfValue());
						}
					}
					//座位数
					if(("BASIC_SEATING").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("zuoWeiShu", vechileParaConfDTO.getParaConfValue());
						}
					}
					//排量
					if(("ENG_EMISSION").equals(vechileParaConfDTO.getParaConfEnm())){
						if(StringUtils.isNotEmpty(vechileParaConfDTO.getParaConfValue())){
							map.put("paiLiang", vechileParaConfDTO.getParaConfValue());
						}
					}
				}
			}
			List<CapPayMaterialVo> caplist = null;
			if (StringUtils.isNotEmpty(prdDtlVO.getActPrdId()) && StringUtils.isNotEmpty(prdDtlVO.getId())){
				PrjPrdVehInfoVO vehInfovo = this.prjPrdVehInfoService.selectById(prdDtlVO.getActPrdId());
				PrjPrdVehInfoVO vehInfo = this.prjPrdVehInfoService.selectByDtlId(prdDtlVO.getId());
				map.put("vin", vehInfovo.getVin());
				map.put("shengChanDt", vehInfovo.getProDt());
				CapPayInfoQueryCondition qc = new CapPayInfoQueryCondition();
				qc.setId(Long.valueOf(id));//付款id
				qc.setPrjPrdDtlId(prdDtlVO.getId());
				qc.setPrjId(prjPrdBscInfoVO.getPrjId());
				qc.setPrjTypCd(vehInfo.getPrjTypCd());
				caplist = this.capPayInfoService.searchMateList(qc);
			}
			if(CollectionUtils.isNotEmpty(caplist)){
				for(CapPayMaterialVo capPayMaterialVo : caplist){
					if(("左45度照片").equals(capPayMaterialVo.getDatNm())){
						map.put("leftImg", capPayMaterialVo.getFilePath());
					}
					if(("右45度照片").equals(capPayMaterialVo.getDatNm())){
						map.put("rigthImg", capPayMaterialVo.getFilePath());
					}
				}
			}
			logger.info("新车检测报告数据数据：" + JSONObject.toJSONString(map));
			//请求pdf生成，返回生成成功后的地址
			file_path = this.generatePdf3(map,request);
			logger.info("新车检测报告地址：" + file_path);
			if(StringUtils.isNotEmpty(file_path)) {
				String pathArray = file_path.replaceAll(PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_ROOT_PATH),"");
				result.setData(PropertiesCacheUtils.getProperty(UploadConstant.UPLOAD_SERVER_PATH) + pathArray);
				result.setSuccess(BaseConstant.IS_YESNO_YES);
			}else {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("生成检测报告失败!");
				return result;
			}
			logger.info("生成新车检测报告最终结果：" + JSONObject.toJSONString(result));
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("createPdf,pdf生成["+id+"].user:{},msg:{}", CurrentThreadContext.getCurrentUserName(),ex.getMessage());
		}catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("系统错误,请联系管理员!");
			logger.error("createPdf,pdf生成失败["+id+"].user:{},msg:{}", CurrentThreadContext.getCurrentUserName(),ex.getMessage());
		}
		return result;
	}


    @SuppressWarnings("static-access")
    private String generatePdf(Map<String, Object> map,HttpServletRequest request) throws BaseException {
        String templateName = "testSimplify";//ftl模板名称（html与其相同）
        String createPdfPath = FileUtil.getServerFilePath("testSimplify");//合同文件存储路径

        URL url = PrjBscInfoController.class.getClassLoader().getResource("template/ftl");
        String path = url.getPath();

        // 组装html和pdf合同的全路径URL
        String localHtmlUrl = path + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".html";
        String localPdfPath = createPdfPath;
        // 判断本地路径是否存在如果不存在则创建
        File localFile = new File(localPdfPath);
        if (!localFile.exists()) {
            localFile.mkdirs();
        }
        String localPdfUrl = localFile + "/" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".pdf";
        try {
            templateName=templateName+".ftl";
            htmHandler(path, templateName, localHtmlUrl, map);// 生成html合同
            pdfHandler(localHtmlUrl, localPdfUrl, request);// 根据html合同生成pdf合同
        } catch (Exception e) {
            e.printStackTrace();
        }
        return localPdfUrl;
    }


	@SuppressWarnings("static-access")
	private String generatePdf2(Map<String, Object> map,HttpServletRequest request) throws BaseException {
		String templateName = "testReport";//ftl模板名称（html与其相同）
		String createPdfPath = FileUtil.getServerFilePath("testReport");//合同文件存储路径

		URL url = PrjBscInfoController.class.getClassLoader().getResource("template/ftl");
		String path = url.getPath();

		// 组装html和pdf合同的全路径URL
		String localHtmlUrl = path + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".html";
		String localPdfPath = createPdfPath;
		// 判断本地路径是否存在如果不存在则创建
		File localFile = new File(localPdfPath);
		if (!localFile.exists()) {
			localFile.mkdirs();
		}
		String localPdfUrl = localFile + "/" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".pdf";
		try {
			templateName=templateName+".ftl";
			htmHandler(path, templateName, localHtmlUrl, map);// 生成html合同
			pdfHandler(localHtmlUrl, localPdfUrl, request);// 根据html合同生成pdf合同
		} catch (Exception e) {
			e.printStackTrace();
		}
		return localPdfUrl;
	}

	@SuppressWarnings("static-access")
	private String generatePdf3(Map<String, Object> map,HttpServletRequest request) throws BaseException {
		String templateName = "newCarReport";//ftl模板名称（html与其相同）
		String createPdfPath = FileUtil.getServerFilePath("newCarReport");//合同文件存储路径

		URL url = PrjBscInfoController.class.getClassLoader().getResource("template/ftl");
		String path = url.getPath();

		// 组装html和pdf合同的全路径URL
		String localHtmlUrl = path + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".html";
		String localPdfPath = createPdfPath;
		// 判断本地路径是否存在如果不存在则创建
		File localFile = new File(localPdfPath);
		if (!localFile.exists()) {
			localFile.mkdirs();
		}
		String localPdfUrl = localFile + "/" + new SimpleDateFormat("yyyyMMddHHmmss").format(new Date()) + ".pdf";
		try {
			templateName=templateName+".ftl";
			htmHandler(path, templateName, localHtmlUrl, map);// 生成html合同
			pdfHandler(localHtmlUrl, localPdfUrl, request);// 根据html合同生成pdf合同
		} catch (Exception e) {
			e.printStackTrace();
		}
		return localPdfUrl;
	}


    /**
     * 生成html格式合同
     */
    private static void htmHandler(String templatePath, String templateName,String htmUrl, Map<String, Object> paramMap) throws Exception {
        Configuration cfg = new Configuration();
        cfg.setDefaultEncoding("UTF-8");
        cfg.setDirectoryForTemplateLoading(new File(templatePath));
        Template template = cfg.getTemplate(templateName);
        File outHtmFile = new File(htmUrl);
        Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outHtmFile), "UTF-8"));
        template.process(paramMap, out);
        out.close();
    }


    /**
     * 生成pdf格式合同
     */
    private static void pdfHandler(String htmUrl, String pdfUrl,HttpServletRequest request)throws DocumentException, IOException {
        File htmFile = new File(htmUrl);
        File pdfFile = new File(pdfUrl);
        String url = htmFile.toURI().toURL().toString();
        OutputStream os = new FileOutputStream(pdfFile);
        ITextRenderer renderer = new ITextRenderer();
        renderer.setDocument(url);
        ITextFontResolver fontResolver = renderer.getFontResolver();
        // 解决中文支持问题
        String path =request.getSession().getServletContext().getRealPath("/PDF/simsun.ttc");
        fontResolver.addFont(path+",0", com.lowagie.text.pdf.BaseFont.IDENTITY_H, BaseFont.NOT_EMBEDDED);
        renderer.layout();
        renderer.createPDF(os);
        os.close();
    }
    /**
     * 审核通过或者审核中的项目（运维功能中的删除）
     */
    @RequestMapping(value = "/removePassAndIngPrjBscInfoByIds.do", method = { RequestMethod.POST })
    @ResponseBody
    public DataResultVO removePassAndIngPrjBscInfoByIds(HttpServletRequest request,
                                    HttpServletResponse response) throws BaseException {
        String ids = request.getParameter("ids");
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
                SysLogConstant.LOG_CMM_DELETE_SUCC);
        if (StringUtils.isEmpty(ids)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_DATA_PK_IS_EMPTY);
            return result;
        }
        List<Long> idList = new ArrayList<Long>();
        JSONArray idsArray = JSONArray.fromObject(ids);
        for (Object object : idsArray) {
            idList.add(Long.valueOf(object.toString()));
        }
        try {
            this.prjBscInfoService.removePassAndIngPrjBscInfoByIds(idList,CurrentThreadContext.getCurrentUserId());
            logger.info("removeById,删除数据.[id=" + ids + "]，user:{}",CurrentThreadContext.getCurrentUserName());
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
            logger.info("removeById,删除数据失败.[id=" + ids + "];msg:{},user:{}"+ ex.getMessage(),CurrentThreadContext.getCurrentUserName());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(SysLogConstant.LOG_CMM_SYS_ERROR);
            logger.error("删除数据失败.id:{}.msg:{},操作人:{}",ids,ex.getMessage(),CurrentThreadContext.getCurrentUserName());
        }
        result.setSuccess(BaseConstant.IS_YESNO_YES);
        return result;
    }

    /**
     * @Author liumengmeng
     * @Description 批量处理自然人星级
     * @Date 16:10 2019/12/19
     * @Param []
     * @return cmm.mid.core.framework.page.DataResultVO
     **/
	@RequestMapping(value = "/batchInsertStarLevel.do", method = { RequestMethod.POST })
	@ResponseBody
    public DataResultVO batchInsertStarLevel(){
		int i = projectApiService.setSplStarLevel();
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES,
				SysLogConstant.LOG_CMM_UPDATE_SUCC);
		result.setData(i);
		return result;
	}

	/**
	 * @Author liuyangd
	 * @Description 批量处理是否自融字段
	 * @Date 2020/1/14
	 * @Param []
	 * @return cmm.mid.core.framework.page.DataResultVO
	 **/
	@RequestMapping(value = "/batchInsertIsSelfMelt.do", method = { RequestMethod.POST })
	@ResponseBody
	public DataResultVO batchInsertIsSelfMelt() throws BaseException {
		int n = projectApiService.setIsSelfMelt();
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES);
		result.setData("更新数量为：" + n);
		result.setInfo(SysLogConstant.LOG_CMM_UPDATE_SUCC);
		return result;
	}

	/**
	 * 到外派业务管理列表页面
	 */
	@RequestMapping(value = "/toExpBusinessListPage.do", method = { RequestMethod.GET})
	public ModelAndView toExpBusinessListPage(HttpServletRequest request, HttpServletResponse response) {
		ModelAndView view = new ModelAndView("project/prjbscinfo/expBusinessList");
		logger.info("跳转到列表页面");
		// 风险隐患
		List<KeyValueVO> hidRiskList = this.prjBscInfoService.getHidRiskList();
		view.addObject("hidRiskList", hidRiskList);
		return view;
	}

	/**
	 * 初始化外派业务管理列表
	 */
	@SuppressWarnings("unchecked")
	@RequestMapping(value = "/initExpBusinessList.do", method = { RequestMethod.GET })
	@ResponseBody
	public Object initExpBusinessList(HttpServletRequest request,
						   HttpServletResponse response) {
		String currentPage = request.getParameter("page");
		String pageSize = request.getParameter("pagesize");
		String lsCntNo = request.getParameter("lsCntNo");
		String stDt = request.getParameter("stDt");
		String endDt = request.getParameter("endDt");
		String cstMgrNm = request.getParameter("cstMgrNm");// 创建人（客户经理）
		String cstNm = request.getParameter("cstNm");
		String hidRisk = request.getParameter("hidRisk");//风险隐患

		Pager page = new Pager();
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setCurrentPage(Integer.parseInt(currentPage));
		}
		if (StringUtils.isNotEmpty(currentPage)) {
			page.setEveryPage(Integer.parseInt(pageSize));
		}

		PrjBscInfoQueryCondition qc = new PrjBscInfoQueryCondition();
		if (StringUtils.isNotBlank(lsCntNo)) {
			qc.setLsCntNo(lsCntNo);
		}
		if(StringUtils.isNotBlank(stDt)){
			qc.setStDt(DateUtils.formatStringToDate(stDt, DateUtils.YYYY_MM_DD));
		}
		if(StringUtils.isNotBlank(endDt)){
			qc.setEndDt(DateUtils.formatStringToDate(endDt, DateUtils.YYYY_MM_DD));
		}
		if (StringUtils.isNotBlank(cstMgrNm)) {
			qc.setCstMgrNm(cstMgrNm);
		}
		if (StringUtils.isNotBlank(cstNm)) {
			qc.setCstNm(cstNm);
		}
		if (StringUtils.isNotBlank(hidRisk)) {
			qc.setHidRisk(hidRisk);
		}
		page.setCondition(qc);
		Pager pager = this.prjBscInfoService.searchExpBusinessListPage(page);
		List<PrjBscInfoVO> list = (List<PrjBscInfoVO>) pager.getResultList();
		logger.info("===查询外派业务数据完成===list:" + JSON.toJSONString(list));
		ListPageVO<PrjBscInfoVO> listPage = new ListPageVO<PrjBscInfoVO>(list, pager.getTotalCount());
		return listPage;
	}

    /**
     * 修改实际供应商、实际联系方式
     */
    @RequestMapping(value = "/modifyRealSpl.do", method = { RequestMethod.POST })
    @ResponseBody
    public Object modifyRealSpl(HttpServletRequest request, HttpServletResponse response) throws BaseException {
        String id = request.getParameter("id");
        String realSplNm = request.getParameter("realSplNm");//实际经销商
        String realTel = request.getParameter("realTel");//实际联系方式
        DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "修改成功!");
        if (StringUtils.isEmpty(id)) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("参数不完整！");
            return result;
        }
        try {
            PrjBscInfoVO entity = new PrjBscInfoVO();
            entity.setId(Long.valueOf(id));
            if (StringUtils.isNotBlank(realSplNm)) {
                entity.setRealSplNm(realSplNm);
            }
            if (StringUtils.isNotBlank(realTel)) {
                entity.setRealTel(realTel);
            }
            boolean success = this.prjBscInfoService.modifyRealSpl(entity);
            if (!success) {
                result.setSuccess(BaseConstant.IS_YESNO_NO);
                result.setInfo("修改失败！");
            }
        } catch (BaseException ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo(ex.getMessage());
			logger.error("修改失败,ex:{}",ex.getMessage());
        } catch (Exception ex) {
            result.setSuccess(BaseConstant.IS_YESNO_NO);
            result.setInfo("修改失败!");
			logger.error("修改失败,ex:{}",ex.getMessage());
        }
        return result;
    }

	/**
	 * 调用撤销资方授信接口
	 */
	@RequestMapping(value = "/cancelInsCredit.do", method = { RequestMethod.POST })
	@ResponseBody
	public Object cancelInsCredit(HttpServletRequest request, HttpServletResponse response) throws BaseException {
		String id = request.getParameter("id");
		logger.info("调用撤销资方授信接口 cancelInsCredit 开始,项目ID={}",id);
		DataResultVO result = new DataResultVO(BaseConstant.IS_YESNO_YES, "资方授信撤销操作成功！");
		if (StringUtils.isEmpty(id)) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("参数不完整！");
			return result;
		}
		try {
			//1.查看项目信息
			PrjBscInfoVO prjBscInfoVO = this.prjBscInfoService.selectById(Long.valueOf(id));
			logger.info("1.调用撤销资方授信接口 cancelInsCredit 执行,根据ID获取项目信息,项目ID={},项目信息={}",id,JSON.toJSONString(prjBscInfoVO));
			if (prjBscInfoVO == null) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("项目信息不存在,请检查！");
				return result;
			}
			/**
			 * 项目撤销资管授信规则
			 * 1.项目资方授信审核结果为【通过】
			 * 2.且未申请资方放款
			 */
			//2.查询授信申请通过结果
			List<QueryStatusDTO> creditResultDTOList = transLogApiService.queryLoanFundStatus(prjBscInfoVO.getId(),prjBscInfoVO.getCstId(),
					prjBscInfoVO.getCertNo(), PrjInsRedmInterfaceInfoConstant.INS_REDM_INTERFACE_RESULT_STATUS_PASS,null);
			logger.info("2.查询授信申请通过结果 项目Id={},prjBscInfoVO={},creditResultDTOList={}" ,prjBscInfoVO.getId(),
					JSON.toJSONString(prjBscInfoVO),JSON.toJSONString(creditResultDTOList));
			if (CollectionUtils.isEmpty(creditResultDTOList)) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("项目资方授信审核结果未通过,不允许撤销资方授信!");
				return result;
			}
			//放款结果为空直接返回 '项目资方已放款,不允许撤销资方授信!'
			for (QueryStatusDTO queryStatusDTO : creditResultDTOList) {
				if (StringUtils.isNotEmpty(queryStatusDTO.getApplyFundStatus())) {
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					result.setInfo("项目已发起资方放款申请,不允许撤销资方授信!");
					return result;
				}
			}
			//3.调用撤销资方授信接口
			DataResultDTO dataResultDTO = null;
			if (PrjBscInfoConstant.PRJ_INS_CODE_WEBANK.equals(prjBscInfoVO.getInsCode())
					|| PrjBscInfoConstant.PRJ_INS_CODE_TYFL.equals(prjBscInfoVO.getInsCode())) {
				//3.1 未接入资管平台的资方,调用service服务
				dataResultDTO = this.projectApiService.cancelInsCredit(PrjBscInfoVOTransform.toDTO(prjBscInfoVO));
			} else if (PrjBscInfoConstant.PRJ_INS_CODE_APFL.equals(prjBscInfoVO.getInsCode())) {
				//3.2 接入资管平台的资方,调用pre-service服务
				ChangeBusinessInfoRequest changeBusinessInfoRequest = new ChangeBusinessInfoRequest();
				changeBusinessInfoRequest.setChangeTypeCode(ChangeTypeCodeEnum.CANCEL_CREDIT.getChangeTypeCode());
				changeBusinessInfoRequest.setBizSN(String.valueOf(prjBscInfoVO.getId()));
				changeBusinessInfoRequest.setInsCode(prjBscInfoVO.getInsCode());
				ResponseData responseData = financialService.changeBusinessInfo(changeBusinessInfoRequest);
				logger.info("3.2 调用撤销资方授信接口 changeBusinessInfo 完成,项目ID={},responseData={}",id,JSON.toJSONString(responseData));
				if (responseData == null) {
					result.setSuccess(BaseConstant.IS_YESNO_NO);
					result.setInfo("调用撤销资方授信接口异常,请检查！");
				} else {
					if (ResponseData.SUCCESS_CODE.equals(responseData.getCode())){
						dataResultDTO = new DataResultDTO(BaseConstant.IS_YESNO_YES, "撤销资方授信成功!");
					} else {
						if (StringUtils.isNotEmpty(responseData.getMessage())){
							dataResultDTO = new DataResultDTO(BaseConstant.IS_YESNO_NO, responseData.getMessage());
						} else {
							dataResultDTO = new DataResultDTO(BaseConstant.IS_YESNO_NO, "撤销资方授信失败!");
						}
					}
				}
			} else {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("该资方不支持撤销资方授信,请检查！");
				return result;
			}
			logger.info("4.调用撤销资方授信接口 cancelInsCredit 完成,项目ID={},dataResultDTO={}",id,JSON.toJSONString(dataResultDTO));
			if (dataResultDTO == null) {
				result.setSuccess(BaseConstant.IS_YESNO_NO);
				result.setInfo("调用撤销资方授信接口异常,请检查！");
			} else {
				result.setSuccess(dataResultDTO.getSuccess());
				result.setInfo(dataResultDTO.getInfo());
			}
		} catch (BaseException ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo(ex.getMessage());
			logger.error("资方授信撤销操作失败,ex:{}",ex.getMessage());
		} catch (Exception ex) {
			result.setSuccess(BaseConstant.IS_YESNO_NO);
			result.setInfo("资方授信撤销操作失败!");
			logger.error("资方授信撤销操作失败,ex:{}",ex.getMessage());
		}
		return result;
	}

	/**
	 * 到列表页面
	 */
	@RequestMapping(value = "/toChoosePrjCstPageForLcv.do", method = { RequestMethod.GET })
	public ModelAndView toChoosePrjCstPageForLcv(HttpServletRequest request,
										   HttpServletResponse response) {
		logger.info("加载选择客户列表页面.");
		String cstRlFlag = request.getParameter("cstRlFlag");
		String cstTypCd = request.getParameter("cstTypCd");
		ModelAndView view = new ModelAndView(
				"project/prjCstInfo/cstBscInfoListForLcv");
		List<KeyValueVO> cststscdlist = this.cstBscInfoService
				.searchCstStsCdList();
		view.addObject("searchSelectCststscdlist", cststscdlist);
		// 客户类型
		List<KeyValueVO> csttypcdlist = this.cstBscInfoService
				.searchCstTypCdList();
		view.addObject("searchSelectCsttypcdlist", csttypcdlist);
		// 事业部
		List<KeyValueVO> orgList = this.cstBscInfoService
				.searchBusinessOrgList();
		view.addObject("orgListList", orgList);
		// 客户关系属性
		List<KeyValueVO> cstRlTypCdList = this.cstBscInfoService
				.searchCstRlTypList();
		view.addObject("cstRlTypCdList", cstRlTypCdList);
		// 查询项要有默认值,这里给出默认值到前端页面显示
		view.addObject("currentBuOrgCd",
				CurrentThreadContext.getCurrentBuOrgCd());
		view.addObject("currentCstRlType",
				DictionaryConstant.CODE_GRP_CST_RL_TYP_CD_1);
		view.addObject("cstRlFlag", cstRlFlag);
		view.addObject("cstTypCd", cstTypCd);
		return view;
	}
}
